[Top][All Lists]

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

yyinitdepth 0

From: tys lefering
Subject: yyinitdepth 0
Date: Wed, 31 Mar 2010 00:54:19 +0200
User-agent: SquirrelMail/1.4.18

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 */

Then running a parser returned yyparse() status 1.

in the output:
Starting parse
Stack size increased to 0
Stack now 0

output in own routines:
parser YYSTACK_ALLOC_MAXIMUM is set -1 and YYSIZE_MAXIMUM is set -1
YYMAXDEPTH is set 10000 YYINITDEPTH is set 0
bison malloc 0x62e460 for 30 bytes
bison free 0x62e460

running a parser with YYINITDEPTH 1 just runs fine.

it looks that setting YYMAXDEPTH < YYINITDEPTH there is no problem.

it is easy to fix in yyparse():

  yystacksize = YYINITDEPTH;
  if (!yystacksize) { yystacksize = 1; }
  YYDPRINTF ((stderr, "Starting parse\n"));


reply via email to

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