From 2c333b66bcbf4278bd5d080a6722aad704160905 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 8 May 2019 01:14:57 -0700 Subject: [PATCH] Fail on invalid token Reading a zero-length TIdnt token causes infinite loops or other failures. --- yacc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yacc.c b/yacc.c index 01f054e..8ea5137 100644 --- a/yacc.c +++ b/yacc.c @@ -837,6 +837,8 @@ nexttk() die("identifier too long"); c = fgetc(fin); } + if (p == idnt) + die("unknown token"); *p = 0; if (strcmp(idnt, "%")==0) if (c=='{') -- 2.20.1