Subject: Re: lib/34632: isalpha() and possibly other ctype functions segfault
To: Antony Dovgal <antony@zend.com>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 09/26/2006 19:37:36
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