Fix bug where the Smalltalk source reader would accept an incomplete

exponent in a real number, e.g., '1e'.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@36774 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2013-06-30 17:24:51 +00:00
parent 4298e255e7
commit bfed68b1c3
2 changed files with 14 additions and 3 deletions

View file

@ -3,8 +3,9 @@
* STSourceReader.m (-lineNumberForIndex:, -readNextToken): Tidy
source.
* STSourceReader.m (-readNextToken): Prevent out of range accesses for
the input string.
* STSourceReader.m (-readNextToken): Bug fixes:
- Prevent out of range accesses for the input string.
- Exponent of a real number must contain at least one digit.
2013-05-26 Wolfgang Lux <wolfgang.lux@gmail.com>

View file

@ -428,7 +428,16 @@ static NSString *_STNormalizeStringToken(NSString *token)
c = GET_CHAR;
}
while ([numericCharacterSet characterIsMember:c])
if (![numericCharacterSet characterIsMember:c])
{
srcOffset--;
tokenRange = NSMakeRange(start, srcOffset - start + 1);
[NSException raise:STCompilerSyntaxException
format:@"Invalid character '%c' in exponent", c];
return STErrorTokenType;
}
do
{
if (AT_END)
{
@ -438,6 +447,7 @@ static NSString *_STNormalizeStringToken(NSString *token)
c = GET_CHAR;
}
while ([numericCharacterSet characterIsMember:c]);
if ([identStartCharacterSet characterIsMember:c])
{