bug-bison
[Top][All Lists]
Advanced

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

Re: yyinitdepth 0


From: Joel E. Denny
Subject: Re: yyinitdepth 0
Date: Sat, 3 Apr 2010 15:23:39 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Wed, 31 Mar 2010, tys lefering wrote:

> Using bison with wrapped malloc/free and testing
> it doing intentionally unusual things with the
> possible settings in bison generated yacc parser
> did not found a segfault situation but came across:
> 
> /* set initial size of parser stack */
> #define YYINITDEPTH 0

The manual says YYINITDEPTH must be a positive integer.

> it is easy to fix in yyparse():
> 
>   yystacksize = YYINITDEPTH;
>   if (!yystacksize) { yystacksize = 1; }
>   YYDPRINTF ((stderr, "Starting parse\n"));

This change is not sufficient to handle YYINITDEPTH=0 because YYINITDEPTH 
is used as the size of several arrays.  At most, I could see throwing a 
#error if YYINITDEPTH=0, but not in 2.4.3, where we're still supposedly 
supporting K&R.




reply via email to

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