* data/glr.c (yyexpandGLRStack): Catch an off-by-one error that

led to a segmentation fault in GNU Pascal.  Problem reported
by Waldek Hebisch.
This commit is contained in:
Paul Eggert
2006-02-27 19:50:59 +00:00
parent 841a773708
commit 18d9185cae
2 changed files with 7 additions and 1 deletions

View File

@@ -1190,7 +1190,7 @@ yyexpandGLRStack (yyGLRStack* yystackp)
size_t yysize, yynewSize;
size_t yyn;
yysize = yystackp->yynextFree - yystackp->yyitems;
if (YYMAXDEPTH <= yysize)
if (YYMAXDEPTH - YYHEADROOM < yysize)
yyMemoryExhausted (yystackp);
yynewSize = 2*yysize;
if (YYMAXDEPTH < yynewSize)