ctype bug

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Wed Jul 6 17:26:36 PDT 2005


On 07.07.2005, at 02:09, Matthew Dillon wrote:
:Matt, the ctype macros ALWAYS worked like this, at the very least 
back to
:the days of 4.4BSD. THIS IS NOT NEW. Just because some programmers 
don't like
:reading the documentation and follow what is clearly written there, 
doesn't mean
:that arbitrary changes are correct.
    No, they never worked like this.  Go back and look at rev 1.1 of
    ctype.h in the FreeBSD source repository.  Guess what it does?  It
    does a range check.
hm. looking at glibc and solaris, they don't do checks.
looking at openbsd, they do it this way:
__inline int isprint(int c)
{
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c) & ....)));
}
what I don't understand is why they even have the -1 in their table 
then...

now I'm split. first I was for bounds checking, but looking at other 
major systems I have to admit that I tend to not check it either. Best 
with a segfault for negative indices < -1 :) whatever. bedtime now.

cheers
  simon
--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Attachment:
PGP.sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00013.pgp
Type: application/octet-stream
Size: 186 bytes
Desc: "Description: This is a digitally signed message part"
URL: <http://lists.dragonflybsd.org/pipermail/commits/attachments/20050706/61b031d6/attachment-0016.obj>


More information about the Commits mailing list