diff options
author | Jim Meyering <meyering@fb.com> | 2013-06-01 19:20:06 -0700 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2013-06-02 09:25:38 -0700 |
commit | 51a8f707131c36d7a88753e3bee839b2a4a336e4 (patch) | |
tree | f8aab34122568f6d1ca476d9d469e4d01125c77e /src/od.c | |
parent | aeaeb87c134ce748527ba99e749b7369fcba2438 (diff) | |
download | coreutils-51a8f707131c36d7a88753e3bee839b2a4a336e4.tar.xz |
od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t
* src/od.c (PRINT_FIELDS): Declare "i" to be of type uintmax_t, so that
the numerator in the expression for "next_pad" does not overflow.
(print_named_ascii): Likewise.
(print_ascii): Likewise.
Bug introduced via commit v6.12-42-g20c0b87.
* tests/misc/od.pl: Exercise each of the three affected code paths.
* NEWS (Bug fixes): Mention it.
Reported by Rich Burridge.
Diffstat (limited to 'src/od.c')
-rw-r--r-- | src/od.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -400,7 +400,7 @@ N (size_t fields, size_t blank, void const *block, \ char const *FMT_STRING, int width, int pad) \ { \ T const *p = block; \ - size_t i; \ + uintmax_t i; \ int pad_remaining = pad; \ for (i = fields; blank < i; i--) \ { \ @@ -456,7 +456,7 @@ print_named_ascii (size_t fields, size_t blank, void const *block, int width, int pad) { unsigned char const *p = block; - size_t i; + uintmax_t i; int pad_remaining = pad; for (i = fields; blank < i; i--) { @@ -487,7 +487,7 @@ print_ascii (size_t fields, size_t blank, void const *block, int pad) { unsigned char const *p = block; - size_t i; + uintmax_t i; int pad_remaining = pad; for (i = fields; blank < i; i--) { |