bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack overflow


From: Paul Eggert
Subject: Re: Stack overflow
Date: Mon, 27 Feb 2006 11:52:56 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Waldek Hebisch <address@hidden> writes:

> bison-2.1 fails to detect stack overflow in GLR parser.

Thanks very much for reporting that.  I installed the following patch,
and it should appear in Bison 2.2.  It's slightly different from your
patch, in an attempt to avoid concerns about integer overflow.

2006-02-27  Paul Eggert  <address@hidden>

        * data/glr.c (yyexpandGLRStack): Catch an off-by-one error that
        led to a segmentation fault in GNU Pascal.  Problem reported
        by Waldek Hebisch.

--- data/glr.c  30 Jan 2006 11:15:15 -0000      1.163
+++ data/glr.c  27 Feb 2006 19:50:28 -0000
@@ -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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]