X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Date: Wed, 20 Feb 2002 13:10:16 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Juan Manuel Guerrero cc: djgpp-workers AT delorie DOT com Subject: Re: SIGSEGV and strlwr/strupr In-Reply-To: <271CA283011@HRZ1.hrz.tu-darmstadt.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.