Related articles |
---|
Input buffer overflow in lex przemek@viewlogic.com (1993-01-04) |
Re: Input buffer overflow in lex... johnl@iecc.cambridge.ma.us (John R. Levine) (1993-01-05) |
Re: Input buffer overflow in lex... vern@daffy.ee.lbl.gov (1993-01-05) |
Re: Input buffer overflow in lex... richw@sol.camb.inmet.com (1993-01-06) |
Re: Input buffer overflow in lex... finger@convex.com (1993-01-08) |
Newsgroups: | comp.compilers |
From: | przemek@viewlogic.com (Przemek Skoskiewicz) |
Organization: | Compilers Central |
Date: | Mon, 4 Jan 1993 23:53:24 GMT |
Keywords: | lex, question, comment |
I've scanned the INDEX and the back issues, but I haven't found any
mention of this bug.
I have the following lex rule to recognize strings enclosed in double
quotes for my grammar. I'm using SunOS 4.1.3's lex/yacc package.
The problem is that the generated lex code doesn't even look at the YYLMAX
variable, which defines the size of the yytext input buffer. As long as
an input string to my grammar is less than the maximum size of the yytext
buffer, everything is fine. For bigger strings, lex overwrites internal
memory and I get a core dump. I used Purify to figure out which variable
was getting corrupted and when.
\"(\\.|[^\\"])*\" {some_action_here ();}
The input string is "aaaa..." with 2000 `a' in it.
Before I start hacking, has anybody ran against this problem and has a
fix? It's rather interesting that there is not a single `if' statement in
the yacc code that would check if the input buffer index is not greater
than YYLMAX.
Viewlogic Systems, Inc. Przemek Skoskiewicz
293 Boston Post Road West
Marlborough, MA 01752-4615, USA
email: przemek@viewlogic.com
[See the next message. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.