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()

Submitted by:  Wim Lewis <wiml>
Submitted on:  Wed 28 Nov 2007 12:13:52 AM UTC  
 
Category: BuildSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Bruno Haible <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>
Project AdministratorIn charge of this item.
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>

 

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 26 Nov 2016 11:51:58 PM UTChaibleCategoryNone=>Build
    Wed 28 Nov 2007 01:14:44 PM UTChaibleStatusNone=>Fixed
      Assigned toNone=>haible
      Open/ClosedOpen=>Closed
    Wed 28 Nov 2007 12:13:53 AM UTCwimlAttached File-=>Added sizet.patch, #14497

    Back to the top


    Powered by Savane 3.1-cleanup1