mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 12:00:05 +00:00
Check for hexadecimal literals exceeding MaxTokenLength.
This commit is contained in:
parent
b1eaf82cc8
commit
9028ed204d
19
Test/baseResults/overlongLiteral.frag.out
Normal file
19
Test/baseResults/overlongLiteral.frag.out
Normal file
@ -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
|
||||||
|
|
1
Test/overlongLiteral.frag
Normal file
1
Test/overlongLiteral.frag
Normal file
@ -0,0 +1 @@
|
|||||||
|
0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
|
@ -420,7 +420,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||||||
|
|
||||||
ival = 0;
|
ival = 0;
|
||||||
do {
|
do {
|
||||||
if (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull)) {
|
if (len < MaxTokenLength && (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull))) {
|
||||||
ppToken->name[len++] = (char)ch;
|
ppToken->name[len++] = (char)ch;
|
||||||
if (ch >= '0' && ch <= '9') {
|
if (ch >= '0' && ch <= '9') {
|
||||||
ii = ch - '0';
|
ii = ch - '0';
|
||||||
@ -433,7 +433,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||||||
ival = (ival << 4) | ii;
|
ival = (ival << 4) | ii;
|
||||||
} else {
|
} else {
|
||||||
if (! AlreadyComplained) {
|
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;
|
AlreadyComplained = 1;
|
||||||
}
|
}
|
||||||
ival = 0xffffffffffffffffull;
|
ival = 0xffffffffffffffffull;
|
||||||
|
@ -183,6 +183,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
"matrix2.frag",
|
"matrix2.frag",
|
||||||
"newTexture.frag",
|
"newTexture.frag",
|
||||||
"Operations.frag",
|
"Operations.frag",
|
||||||
|
"overlongLiteral.frag",
|
||||||
"prepost.frag",
|
"prepost.frag",
|
||||||
"simpleFunctionCall.frag",
|
"simpleFunctionCall.frag",
|
||||||
"structAssignment.frag",
|
"structAssignment.frag",
|
||||||
|
Loading…
Reference in New Issue
Block a user