Fix array out of bounds bug in processing if-else-endif macros.
If we are not inside an if macro, we cannot simply decrease elsetracker. Fixes https://github.com/KhronosGroup/glslang/issues/29.
This commit is contained in:
parent
f7497e289b
commit
24e4bc99ac
5 changed files with 27 additions and 3 deletions
|
|
@ -867,12 +867,13 @@ int TPpContext::readCPPline(TPpToken* ppToken)
|
|||
token = CPPelse(0, ppToken);
|
||||
break;
|
||||
case PpAtomEndif:
|
||||
elseSeen[elsetracker] = false;
|
||||
--elsetracker;
|
||||
if (! ifdepth)
|
||||
parseContext.ppError(ppToken->loc, "mismatched statements", "#endif", "");
|
||||
else
|
||||
else {
|
||||
elseSeen[elsetracker] = false;
|
||||
--elsetracker;
|
||||
--ifdepth;
|
||||
}
|
||||
token = extraTokenCheck(PpAtomEndif, ppToken, scanToken(ppToken));
|
||||
break;
|
||||
case PpAtomIf:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue