cmd/yacc: do not create an out of bounds pointer

An out of bounds pointer/array index being created is an error in
standard C.

Updates #313

Change-Id: I7108fcde1a8e03017e9ab852adb737940489c827
This commit is contained in:
Neven Sajko 2019-08-22 11:28:53 +00:00 committed by Russ Cox
parent 7ba9f9467d
commit 4a3f20bcee

View file

@ -2819,8 +2819,9 @@ stin(int i)
for(n = -maxoff; n < ACTSIZE; n++) {
flag = 0;
for(r = q1; r < q2; r += 2) {
if((s = *r + n + amem) < amem)
if(*r + n < 0)
goto nextn;
s = *r + n + amem;
if(*s == 0)
flag++;
else