X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f From: "Juan Manuel Guerrero" Organization: Darmstadt University of Technology To: Eli Zaretskii Date: Wed, 20 Feb 2002 22:44:43 +0100 Subject: Re: SIGSEGV and strlwr/strupr CC: djgpp-workers AT delorie DOT com References: <271CA283011 AT HRZ1 DOT hrz DOT tu-darmstadt DOT de> In-reply-to: X-mailer: Pegasus Mail for Windows (v2.54DE) Message-ID: <27CD28B3260@HRZ1.hrz.tu-darmstadt.de> Reply-To: djgpp-workers AT delorie DOT com On Wed, 20 Feb 2002, Eli Zaretskii wrote: > On Wed, 20 Feb 2002, Juan Manuel Guerrero wrote: > > It works OK as long as some kind of windows is used as dpmi server. > > As soon as cwsdpmi is used, bison dies with an error=0004. > > The reason is that strlwr() does not check if the passed pointer > > is a NULL pointer. In this case the while-loop derefences a NULL pointer > > producing the SIGSEGV. This is the reason why for certain combinations > > of command-line options bison 1.32/33 breaks on plain dos. > > The small patch below will fix this for strlwr and strupr (suffers from the > > same bug). > > I think it is wrong to patch string-related library functions to protect > them from NULL pointers. ALL string-related functions have the same > problem. It is programmer's responsibility to avoid passing NULL > pointers to library functions, except in those cases where the function > is explicitly documented to be able to accept NULL pointers. > > So I think the real fix should be in Bison, not in the library. OK. Fixed in bison and patch submitted to bison maintainers. Regards, Guerrero, Juan Manuel