[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stack overflow
From: |
Waldek Hebisch |
Subject: |
Stack overflow |
Date: |
Sat, 25 Feb 2006 13:20:33 +0100 (CET) |
bison-2.1 fails to detect stack overflow in GLR parser. Namely,
`yyglrShiftDefer' assumes that there are 2 free stack slots, and
check is done only in `yyaddDeferredAction'. However, `yyexpandGLRStack'
only guaranteed increase by one. The problem appered in GNU Pascal,
causing segmentation faults due to parser stack overflow. I do not
include a testcase since GNU Pascal parser is large.
The following patch fixed the problem:
--- bison-2.1/data/glr.c.bb 2006-02-25 13:30:31.182883336 +0100
+++ bison-2.1/data/glr.c 2006-02-25 13:32:29.239935936 +0100
@@ -1089,7 +1089,7 @@
size_t yysize, yynewSize;
size_t yyn;
yysize = yystack->yynextFree - yystack->yyitems;
- if (YYMAXDEPTH <= yysize)
+ if (YYMAXDEPTH < yysize + YYHEADROOM)
yyMemoryExhausted (yystack);
yynewSize = 2*yysize;
if (YYMAXDEPTH < yynewSize)
--
Waldek Hebisch
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Stack overflow,
Waldek Hebisch <=