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 /pngread.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 'pngread.c')
-rw-r--r-- | pngread.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3231,7 +3231,7 @@ png_image_read_colormapped(png_voidp argument) png_uint_32 y = image->height; png_bytep row = png_voidcast(png_bytep, display->first_row); - while (y-- > 0) + for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); row += row_bytes; @@ -4064,7 +4064,7 @@ png_image_read_direct(png_voidp argument) png_uint_32 y = image->height; png_bytep row = png_voidcast(png_bytep, display->first_row); - while (y-- > 0) + for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); row += row_bytes; |