discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in NSPredicate _evaluateLeftValue:rightValue:object implementation


From: Mathias Bauer
Subject: Bug in NSPredicate _evaluateLeftValue:rightValue:object implementation
Date: Thu, 13 Feb 2014 16:25:42 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

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.

Regards,
Mathias



reply via email to

[Prev in Thread] Current Thread [Next in Thread]