diff --git a/Test/baseResults/overlongLiteral.frag.out b/Test/baseResults/overlongLiteral.frag.out new file mode 100644 index 00000000..372d7777 --- /dev/null +++ b/Test/baseResults/overlongLiteral.frag.out @@ -0,0 +1,19 @@ +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 + diff --git a/Test/overlongLiteral.frag b/Test/overlongLiteral.frag new file mode 100644 index 00000000..c351ed6b --- /dev/null +++ b/Test/overlongLiteral.frag @@ -0,0 +1 @@ +0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; diff --git a/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/glslang/MachineIndependent/preprocessor/PpScanner.cpp index fa01549d..d1ddf685 100644 --- a/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -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; diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index d8510aa5..9ca88ff8 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -183,6 +183,7 @@ INSTANTIATE_TEST_CASE_P( "matrix2.frag", "newTexture.frag", "Operations.frag", + "overlongLiteral.frag", "prepost.frag", "simpleFunctionCall.frag", "structAssignment.frag",