rcj@burl.UUCP (R. Curtis Jackson) (04/18/84)
Well, last year about this time I found a bug in yacc(1) [actually in its documentation] that cost me three weeks of valuable time to track down, since I assumed it was my program which was in error. This year it is lex(1), same situation only I found this one quicker: lex reserves a certain amount of space for its input buffer -- I haven't taken the time to check how much -- that is left as an exercise for the reader. If you are trying to match some hellaciously long strings or, like myself, you screw up and accidentally match a hellaciously long string, you will get either a memory fault or a bus error in your program. This is because lex does not check to see whether it has filled its input array and keeps merrily on writing into random areas of memory. I am going to get all the specifics on this problem to submit to the Unix Hotline (although it has been over a year since I told them about the bug in the yacc(1) documentation and I haven't seen that corrected). If anyone is interested in more particulars, drop me a line and I will send it -- the bug fix should be trivial once you know the problem. By the way, could some lucky person who has the System V Release 2 Programmer's (not User's) Manuals look at the yacc(1) documentation and see if anything is mentioned about token numbers over 1000 not being allowed? Maybe they did process the documentation MR and I just haven't seen the results. Thanks in advance, -- The MAD Programmer -- 919-228-3313 (Cornet 291) alias: Curtis Jackson ...![ ihnp4 ulysses cbosgd clyde ]!burl!rcj
kim@enea.UUCP (05/07/84)
#R:burl:-43600:enea:600001:000:583 enea!kim Apr 24 11:03:00 1984 Yes, I was hit by this bug a year ago. Looking at the output from lex (the version supplied with 4.1bsd) reveals that the size of 'yytext' and some related areas are only 200 chars! Since lex does not check for overflow, the simplest fix is to increase the buffer size by redefining the symbol YYLMAX. After discovering the bug, I routinely include the following two lines: # undef YYLMAX # define YYLMAX 10000 at the start of each lex program, and then I will get a 'bus error' only when trying to match an abnormally long string by mistake. Kim Walden ...mcvax!enea!kim