bugGNU gettext - Bugs: bug #21659, signed/unsigned mismatch in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #21659: signed/unsigned mismatch in _nl_normalize_codeset()

Submitter:  Wim Lewis <wiml>
Submitted:  Wed 28 Nov 2007 12:13:52 AM UTC
   
 
Category:  Build Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Wed 28 Nov 2007 01:14:44 PM UTC, comment #1: 

Your patch is right, but the argumentation is not. gcc's
warnings about signed and unsigned are normally better turned
off by using -Wno-sign-compare.

But here, on platforms where size_t and int have the
same size, when passing a string whose length is > 2^31 but
< 2^32, the 'int len' could overflow. And 'int' overflow can
be fatal when a modern compiler like gcc-4.3.0 is used.
For this reason, I'm applying your patch.

Bruno Haible <haible>
Group administrator
Wed 28 Nov 2007 12:13:52 AM UTC, original submission:  

'len' is used in an expression of type size_t, and is computed from one as well; it's more consistent for it to be declared size_t instead of int. This change quells a compile-time warning about signed vs unsigned values if I crank the warning level up.

Attached is a really trivial patch.


Wim Lewis <wiml>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by wiml (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-04 haible StatusFixed Fix Released
    2016-11-26 haible CategoryNone Build
    2007-11-28 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
    2007-11-28 wiml Attached File- Added sizet.patch, #14497

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code