Commit 9028ed20 by Aaron Muir Hamilton

Check for hexadecimal literals exceeding MaxTokenLength.

parent b1eaf82c
overlongLiteral.frag
ERROR: 0:1: '' : hexadecimal literal too long
ERROR: 0:1: '' : syntax error, unexpected INTCONSTANT
ERROR: 2 compilation errors. No code generated.
Shader version: 100
ERROR: node is still EOpNull!
0:? Linker Objects
Linked fragment stage:
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 100
ERROR: node is still EOpNull!
0:? Linker Objects
0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
......@@ -420,7 +420,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ival = 0;
do {
if (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull)) {
if (len < MaxTokenLength && (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull))) {
ppToken->name[len++] = (char)ch;
if (ch >= '0' && ch <= '9') {
ii = ch - '0';
......@@ -433,7 +433,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ival = (ival << 4) | ii;
} else {
if (! AlreadyComplained) {
pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", "");
if(len < MaxTokenLength)
pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", "");
else
pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too long", "", "");
AlreadyComplained = 1;
}
ival = 0xffffffffffffffffull;
......
......@@ -183,6 +183,7 @@ INSTANTIATE_TEST_CASE_P(
"matrix2.frag",
"newTexture.frag",
"Operations.frag",
"overlongLiteral.frag",
"prepost.frag",
"simpleFunctionCall.frag",
"structAssignment.frag",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment