Add assertion check for potential UAF trigger

It actually currently triggers if an INCLUDE directive is given at EOF,
but #742 will fix that.
This commit is contained in:
ISSOtm
2021-02-19 16:52:35 +01:00
parent 6ef3ee1391
commit cd072d5e6a
2 changed files with 18 additions and 6 deletions

View File

@@ -24,7 +24,7 @@
#define MAXINCPATHS 128
#ifdef LEXER_DEBUG
#define dbgPrint(...) fprintf(stderr, "[lexer] " __VA_ARGS__)
#define dbgPrint(...) fprintf(stderr, "[fstack] " __VA_ARGS__)
#else
#define dbgPrint(...)
#endif
@@ -270,6 +270,7 @@ bool yywrap(void)
struct Context *context = contextStack;
contextStack = contextStack->parent;
assert(contextDepth != 0); // This is never supposed to underflow
contextDepth--;
lexer_DeleteState(context->lexerState);