delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/20/06:15:01

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 <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Juan Manuel Guerrero <ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De>
cc: djgpp-workers AT delorie DOT com
Subject: Re: SIGSEGV and strlwr/strupr
In-Reply-To: <271CA283011@HRZ1.hrz.tu-darmstadt.de>
Message-ID: <Pine.SUN.3.91.1020220130735.24579A-100000@is>
MIME-Version: 1.0
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

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019