bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sharutils PATCH] build: avoid range errors in use of ctype function


From: Bruce Korb
Subject: Re: [sharutils PATCH] build: avoid range errors in use of ctype functions
Date: Tue, 06 Jan 2015 17:45:19 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 01/06/15 16:27, Eric Blake wrote:
On platforms where 'char' is signed, using ctype functions on
'char' arguments produces undefined behavior for arguments that
are larger than 127.  In particular, on Cygwin, isspace((char)255)
MUST return the same 0 result as isspace(EOF), while there are some
single-byte locales in which isspace((unsigned char)255) returns 1.

Ban such locales?  ;)  Ick.  Thank you so much for going through the
stuff.  I think I will fix the "%zu" thing by casting the argument
as unsigned int -- if for no other reason than to save translation effort.

There are also a number of ctype abuses in libopts/makeshell.c,
but as that file is generated rather than owned by sharutils, it
will need to be fixed upstream in the autogen package.

I'll go chastise that upstream maintainer for you.
I've fixed the shartutils stuff, but the latter will take longer.
Thanks! - Bruce



reply via email to

[Prev in Thread] Current Thread [Next in Thread]