Fix issue #391: input stack underflow on too few macro arguments.

This commit is contained in:
John Kessenich 2016-07-19 14:32:52 -06:00
parent f8332509b9
commit 31a51becd2
6 changed files with 22 additions and 4 deletions

View file

@ -218,7 +218,7 @@ protected:
TParseContextBase& parseContext;
// Get the next token from *stack* of input sources, popping input sources
// that are out of tokens, down until an input sources is found that has a token.
// that are out of tokens, down until an input source is found that has a token.
// Return EndOfInput when there are no more tokens to be found by doing this.
int scanToken(TPpToken* ppToken)
{
@ -226,7 +226,7 @@ protected:
while (! inputStack.empty()) {
token = inputStack.back()->scan(ppToken);
if (token != EndOfInput)
if (token != EndOfInput || inputStack.empty())
break;
popInput();
}