Re: Public disclosure of discovered vulnerabilities
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


sci.crypt archive

Re: Public disclosure of discovered vulnerabilities

From: Bryan Olson <fakeaddress@nowhere.org>
Date: Sun May 29 2005 - 00:15:26 CEST

Douglas A. Gwyn wrote:
> Bryan Olson wrote:
>
>> You said exactly what I said you said. You were wrong. No, it is
>> not perfectly safe to feed any character code to toupper().
>> According to the C standard, it can induce undefined behavior.
>
> Wrong, wrong, wrong, and wrong. If you would make the
> *effort*, perhaps you would finally understand what I
> did say.

Here it is for *anyone* to understand:

     Olson has mischaracterized the issue, as usual. The toupper
     function has an int argument, not char, and it is perfectly
     safe to feed it any character code (or EOF). Olson's
     problem seems to be that he was unaware of the possibility
     of sign extension upon widening of a signed integer type,
     which might necessitate masking off the extension. Of
     *course* if you feed a wildly out-of-range value to toupper
     you get undefined behavior.

> By continuing to reinterpret it according to
> your preconception, you continue to miss the point.

Negative character codes are consistent with the C standard, and
common systems, character codes may also be to large to fit in
an unsigned char; that's why C has wide characters and
towupper(). The C standard says: [ISO/IEC 9899:1999]:

     7.4 (ctype.h)

     The header <ctype.h> declares several functions useful for
     classifying and mapping characters. In all cases the
     argument is an int, the value of which shall be
     representable as an unsigned char or shall equal the value
     of the macro EOF. If the argument has any other value, the
     behavior is undefined.

>> I did not mischaracterize the issue. Harbison & Steele disagrees
>> with the C standard, as does what you asserted.
>
> Assuming H&S did say that toupper can safely be passed
> any arbitrary value representable in type char, then
> indeed they were wrong. I never said nor implied that
> they were right about that.

So why did you say I mischaracterized the issue? The issue was
exactly what I explained. Why did you post that utterly wrong
explanation that the issue is a sign-extension problem and why
have you not retracted it?

-- 
--Bryan
Received on Thu Sep 29 21:39:04 2005