mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
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>
This commit is contained in:
@@ -478,7 +478,7 @@ get_valid(display *d, png_infop info_ptr)
|
||||
png_textp text;
|
||||
png_uint_32 ntext = png_get_text(d->png_ptr, info_ptr, &text, NULL);
|
||||
|
||||
while (ntext-- > 0) switch (text[ntext].compression)
|
||||
while (ntext > 0) switch (text[--ntext].compression)
|
||||
{
|
||||
case -1:
|
||||
flags |= PNG_INFO_tEXt;
|
||||
|
||||
Reference in New Issue
Block a user