Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 exptools 1/6/84; site ihuxr.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!ihuxr!pem1a From: pem1a@ihuxr.UUCP (Tom Portegys) Newsgroups: net.lang.c Subject: Re: C and AWK questions Message-ID: <1172@ihuxr.UUCP> Date: Fri, 17-Aug-84 16:26:10 EDT Article-I.D.: ihuxr.1172 Posted: Fri Aug 17 16:26:10 1984 Date-Received: Sun, 19-Aug-84 01:22:56 EDT Organization: AT&T Bell Labs, Naperville, IL Lines: 19 On your awk/malloc problem: We just got done finding a nasty bug in a lex program which clobbered the malloc memory. It either gave memory faults or looped. Turned out to be caused by an overflow of an array called yytext, which holds the input characters being matched. This array was compiled to hold 200 characters, yet an expression we wanted to match could far exceed that. So lex merrily proceeded to overflow the array and destroy the malloc linkages. The bug would appear when an fprintf attempted to get some memory from malloc. The answer was to either make the array yytext bigger, or to change the way to match the expression. We chose the latter. We were also very disappointed that lex did not do any special checking on this overflow problem. Tom Portegys, Grant Rose, Mark Young Bell Labs, Naperville, Ill. ihnp4!ihuxr!pem1a