NSPredicate with an illegal regex dies on evaluation

Originator:me
Number:rdar://10056152 Date Originated:31-Aug-2011 02:50 PM
Status:Open Resolved:
Product:Mac OS X Product Version:
Classification:Crash/Hang/Data Loss Reproducible:Always
 
31-Aug-2011 02:50 PM Jonathon Mah:
'NSPredicate exception.txt' was successfully uploaded

31-Aug-2011 02:50 PM Jonathon Mah:
It's possible to create a predicate with a bad regular expression. When that predicate is evaluated, the regex parser thingy throws chow. This is the worst of both worlds, since we can create a predicate and store it (say, in a smart folder), but that will crash when evaluated. But I've already saved by this point, so re-launching will bring back the killer predicate.

[[NSPredicate predicateWithFormat:@"self MATCHES '^[]*'"] evaluateWithObject:@"hi"];



'NSInternalInconsistencyException', reason '*** Can't do regex matching,
reason: Can't open pattern U_REGEX_MISSING_CLOSE_BRACKET (string hi,
pattern ^[]*, case 1, canon 2)'


31-Aug-2011 02:54 PM Jonathon Mah:
Also MATCHES "\0" causes untimely death.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!