Subject: Re: lib/34632: isalpha() and possibly other ctype functions segfault
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 09/26/2006 23:40:04
The following reply was made to PR lib/34632; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: Antony Dovgal <antony@zend.com>, gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, tony2001@php.net
Subject: Re: lib/34632: isalpha() and possibly other ctype functions segfault
Date: Tue, 26 Sep 2006 19:37:36 -0400

 On Sep 27,  1:50am, antony@zend.com (Antony Dovgal) wrote:
 -- Subject: Re: lib/34632: isalpha() and possibly other ctype functions segfa
 
 | On 27.09.2006 01:10, Christos Zoulas wrote:
 | >  This is not a bug. Undefined includes "segmentation fault". This is why
 | >  we cast to (unsigned char) in our sources.
 | 
 | Ok, but I'm afraid you'd need to add this to the docs and inform such projects as: SQLite, PCRElib, libxml2 and many more which do not cast it to (unsigned char) either.
 | Currently I can see similar "expected" behaviour only on Solaris, which also segfaults in this case.
 | Other systems (AIX, MacOS, various Linuxes) have chosen a user-friendly way and return 0.
 
 Being friendly is a slippery slope. What's next? Handling NULL pointers in
 strcpy()?
 The best way is to submit patches and feed them back to the maintainers.
 As far as the documentation goes we can say "undefined behavior including
 Segmentation faults". Is that good enough?
 
 christos