GNU 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: |
Bruno Haible <haible> |
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.
|
Wim Lewis <wiml> |
Attached Files
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
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 | Status | Fixed | Fix Released | |
2016-11-26 | haible | Category | None | Build | |
2007-11-28 | haible | Status | None | Fixed | |
Assigned to | None | haible | |||
Open/Closed | Open | Closed | |||
2007-11-28 | wiml | Attached File | - | Added sizet.patch, #14497 |
Powered by Savane 3.13-4b48.
Corresponding source code
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.