When we tried to get the number token, if it’s over the integer limits
2147483647(0x7fffffff)
and becomes the minor (-2147483647), we will never get the correct number.
For example,
Peek(0x8c000000,4);
The arguments pass to the peek() are
Peek(0,4);
This is because the LexGetNumber () will check the MAX_CHAR_VALUE, but does
not care the minor number
enum LexToken LexGetNumber(struct LexState *Lexer, struct Value *Value)
{
...
if (Result <= MAX_CHAR_VALUE)
{
Value->Typ = &CharType;
Value->Val->Character = Result;
ResultToken = TokenCharacterConstant;
}
else
{
Value->Typ = &IntType;
Value->Val->Integer = Result;
ResultToken = TokenIntegerConstant;
}
...
}.
What I did is as following, it might not be a good/right fix, but I am
using it now.
enum LexToken LexGetNumber(struct LexState *Lexer, struct Value *Value)
{
...
if (Result >= 0 && Result <= MAX_CHAR_VALUE)
{
Value->Typ = &CharType;
Value->Val->Character = Result;
ResultToken = TokenCharacterConstant;
}
else
{
Value->Typ = &IntType;
Value->Val->Integer = Result;
ResultToken = TokenIntegerConstant;
}
...
}.
Original issue reported on code.google.com by zik.sale...@gmail.com on 2 Jun 2010 at 5:54
Original issue reported on code.google.com by
zik.sale...@gmail.com
on 2 Jun 2010 at 5:54