[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in NSPredicate _evaluateLeftValue:rightValue:object implementati
From: |
Richard Frith-Macdonald |
Subject: |
Re: Bug in NSPredicate _evaluateLeftValue:rightValue:object implementation |
Date: |
Thu, 13 Feb 2014 15:46:09 +0000 |
On 13 Feb 2014, at 15:25, Mathias Bauer <mathias_bauer@gmx.net> wrote:
> Hi dear list members,
>
> I came across the following code in NSPredicate.m:
>
> ( it's in
> - (BOOL) _evaluateLeftValue: (id)leftResult
> rightValue: (id)rightResult
> object: (id)object
> line 968ff.)
>
>> case NSEndsWithPredicateOperatorType:
>> {
>> NSRange range;
>>
>> range = NSMakeRange([leftResult length] - [rightResult length],
>> [rightResult length]);
>> return ([leftResult compare: rightResult
>> options: compareOptions
>> range: range] == NSOrderedSame ? YES : NO);
>> }
>
> IMHO there needs to be a check whether rightResult is longer than leftResult,
> as in this case NSMakeRange will throw an exception.
Thanks, I added a check as you suggest.