Thread: Re: [Flex-devel] Index underflow in lex(1)
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Michael M. <mm...@my...> - 2015-11-30 21:42:37
|
Serguey Parkhomovsky wrote: > On Thu, Nov 26, 2015 at 01:03:22PM -0500, Michael McConville wrote: > > This nondeterministically underflows _sf_top_ix, causing a segfault: > > > > http://www.sccs.swarthmore.edu/users/16/mmcconv1/dump/crash.l > > > > Looks like _sf_top_ix always underflows whenever there are extra closing > parentheses in the rules section. The nondeterministic behavior is > probably heap layout related. > > I've taken your suggestion and updated scan.l to give a syntax error > when there is an unbalanced parenthesis, which fixes the issue: Forwarding to upstream. > Index: scan.l > =================================================================== > RCS file: /cvs/src/usr.bin/lex/scan.l,v > retrieving revision 1.12 > diff -u -p -r1.12 scan.l > --- scan.l 19 Nov 2015 23:34:56 -0000 1.12 > +++ scan.l 30 Nov 2015 21:19:44 -0000 > @@ -741,7 +741,13 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; / > return '('; > } > "(" sf_push(); return '('; > - ")" sf_pop(); return ')'; > + ")" { > + if (_sf_top_ix > 0) { > + sf_pop(); > + return ')'; > + } else > + synerr(_("unbalanced parenthesis")); > + } > > [/|*+?.(){}] return (unsigned char) yytext[0]; > . RETURNCHAR; |
From: Will E. <wes...@gm...> - 2015-12-01 00:25:37
|
Much appreciated. On Monday, 30 November 2015, 4:22 pm -0800, Serguey Parkhomovsky <ser...@gm...> wrote: > On Mon, Nov 30, 2015 at 06:51:39PM -0500, Will Estes wrote: > > Awesome. This applies cleanly albeit with fuzz and makes sense. > > > > Could you provide Serguey Parkhomovsky's email address so I can use it when committing the change into git? > > Happy to help. :-) > > The address that I'm sending from right now is OK. As well, I believe > this patch fixes #193 and #194 in flex's bugtracker. -- Will Estes wes...@gm... |
From: Will E. <wes...@gm...> - 2015-12-01 00:47:31
|
Here's the patch as it was applied to the flex tree. It'll go out in the next release. https://github.com/westes/flex/commit/9ba6e5283efd2fe454d3bc92eca960b3ebd91294 On Monday, 30 November 2015, 4:22 pm -0800, Serguey Parkhomovsky <ser...@gm...> wrote: > On Mon, Nov 30, 2015 at 06:51:39PM -0500, Will Estes wrote: > > Awesome. This applies cleanly albeit with fuzz and makes sense. > > > > Could you provide Serguey Parkhomovsky's email address so I can use it when committing the change into git? > > Happy to help. :-) > > The address that I'm sending from right now is OK. As well, I believe > this patch fixes #193 and #194 in flex's bugtracker. -- Will Estes wes...@gm... |
From: Will E. <wes...@gm...> - 2015-11-30 23:51:49
|
Awesome. This applies cleanly albeit with fuzz and makes sense. Could you provide Serguey Parkhomovsky's email address so I can use it when committing the change into git? On Monday, 30 November 2015, 4:42 pm -0500, Michael McConville <mm...@my...> wrote: > Serguey Parkhomovsky wrote: > > On Thu, Nov 26, 2015 at 01:03:22PM -0500, Michael McConville wrote: > > > This nondeterministically underflows _sf_top_ix, causing a segfault: > > > > > > http://www.sccs.swarthmore.edu/users/16/mmcconv1/dump/crash.l > > > > > > > Looks like _sf_top_ix always underflows whenever there are extra closing > > parentheses in the rules section. The nondeterministic behavior is > > probably heap layout related. > > > > I've taken your suggestion and updated scan.l to give a syntax error > > when there is an unbalanced parenthesis, which fixes the issue: > > Forwarding to upstream. > > > Index: scan.l > > =================================================================== > > RCS file: /cvs/src/usr.bin/lex/scan.l,v > > retrieving revision 1.12 > > diff -u -p -r1.12 scan.l > > --- scan.l 19 Nov 2015 23:34:56 -0000 1.12 > > +++ scan.l 30 Nov 2015 21:19:44 -0000 > > @@ -741,7 +741,13 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; / > > return '('; > > } > > "(" sf_push(); return '('; > > - ")" sf_pop(); return ')'; > > + ")" { > > + if (_sf_top_ix > 0) { > > + sf_pop(); > > + return ')'; > > + } else > > + synerr(_("unbalanced parenthesis")); > > + } > > > > [/|*+?.(){}] return (unsigned char) yytext[0]; > > . RETURNCHAR; > > ------------------------------------------------------------------------------ > Go from Idea to Many App Stores Faster with Intel(R) XDK > Give your users amazing mobile app experiences with Intel(R) XDK. > Use one codebase in this all-in-one HTML5 development environment. > Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 > _______________________________________________ > Flex-devel mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-devel -- Will Estes wes...@gm... |