diff options
author | John Bowler <jbowler@acm.org> | 2016-09-30 18:37:22 -0700 |
---|---|---|
committer | John Bowler <jbowler@acm.org> | 2016-09-30 18:37:22 -0700 |
commit | 319c9852bf65a5ff587328ec9f1e3a7873f8d044 (patch) | |
tree | ce41ea17e9c298157d788df0e6351c3e6bbc5c6b /pngtrans.c | |
parent | 04dab1e82db2b6b038cda57a1918e132da6e58b5 (diff) |
Unsigned overflow
Remove all currently detected cases of unsigned overflow. Detection is
runtime, so test case dependent. The changes to pngvalid.c eliminate
spurious and probably invalid tests with one while loop exception.
Apart from that and the change to the dependence on the intended
unsigned overflow in pngtrans.c the changes are limited to altering the
meme for an unsigned 'x' from:
while (x-- > 0)
to
for (; x > 0; --x)
This works because, in all cases, the control variable is not used in
the loop. The 'while' meme was, at one time, warn'ed by GCC so it is
probably a good change, for some weird religious value of good.
Signed-off-by: John Bowler <jbowler@acm.org>
Diffstat (limited to 'pngtrans.c')
-rw-r--r-- | pngtrans.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pngtrans.c b/pngtrans.c index e5cbd79b9..2cc7d7b1a 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -693,7 +693,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) * and this calculation is used because it avoids warnings that other * forms produced on either GCC or MSVC. */ - int padding = (-row_info->pixel_depth * row_info->width) & 7; + int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width); png_bytep rp = png_ptr->row_buf + row_info->rowbytes; switch (row_info->bit_depth) |