improve error checking

This commit is contained in:
Richard Frith-Macdonald 2018-02-06 18:05:28 +00:00
parent c0d6599def
commit 033b921903
2 changed files with 11 additions and 2 deletions

View file

@ -11,6 +11,7 @@
* Source/NSPropertyList.m: check step before use
* Source/NSDate.m: add comment that we are ignoring non-digits
* Source/NSCache.m: use double division for calcualting averrage
* Source/NSPredicate.m: check for termination of quoted strings
2018-02-05 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -2404,7 +2404,11 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
format: @"Invalid double quoted literal at %u", location];
}
[self setCharactersToBeSkipped: skip];
[self scanString: @"\"" intoString: NULL];
if (NO == [self scanString: @"\"" intoString: NULL])
{
[NSException raise: NSInvalidArgumentException
format: @"Unterminated double quoted literal at %u", location];
}
return [NSExpression expressionForConstantValue: str];
}
@ -2421,7 +2425,11 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
format: @"Invalid single quoted literal at %u", location];
}
[self setCharactersToBeSkipped: skip];
[self scanString: @"'" intoString: NULL];
if (NO == [self scanString: @"'" intoString: NULL])
{
[NSException raise: NSInvalidArgumentException
format: @"Unterminated single quoted literal at %u", location];
}
return [NSExpression expressionForConstantValue: str];
}