[libpng16] Quiet a "comparison always true" warning in pngstest.c (John Bowler).

This commit is contained in:
John Bowler 2014-12-16 19:18:06 -06:00 committed by Glenn Randers-Pehrson
parent 0659cddd21
commit a00ea0aeae
3 changed files with 30 additions and 17 deletions

View File

@ -1,4 +1,4 @@
Libpng 1.6.16beta03 - December 15, 2014 Libpng 1.6.16beta03 - December 17, 2014
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -35,7 +35,8 @@ Version 1.6.16beta02 [December 15, 2014]
Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS; Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS;
renamed scripts/*.dfn to scripts/*.c (John Bowler). renamed scripts/*.dfn to scripts/*.c (John Bowler).
Version 1.6.16beta03 [December 15, 2014] Version 1.6.16beta03 [December 17, 2014]
Quiet a "comparison always true" warning in pngstest.c (John Bowler).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -5109,7 +5109,8 @@ Version 1.6.16beta02 [December 15, 2014]
Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS; Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS;
renamed scripts/*.dfn to scripts/*.c (John Bowler). renamed scripts/*.dfn to scripts/*.c (John Bowler).
Version 1.6.16beta03 [December 15, 2014] Version 1.6.16beta03 [December 17, 2014]
Quiet a "comparison always true" warning in pngstest.c (John Bowler).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -3173,7 +3173,9 @@ read_one_file(Image *image)
{ {
long int cb = ftell(f); long int cb = ftell(f);
if (cb > 0 && (unsigned long int)cb < (size_t)~(size_t)0) if (cb > 0)
{
if ((unsigned long int)cb <= (size_t)~(size_t)0)
{ {
png_bytep b = voidcast(png_bytep, malloc((size_t)cb)); png_bytep b = voidcast(png_bytep, malloc((size_t)cb));
@ -3201,6 +3203,15 @@ read_one_file(Image *image)
": out of memory: "); ": out of memory: ");
} }
else
return logclose(image, f, image->file_name,
": file too big for this architecture: ");
/* cb is the length of the file as a (long) and
* this is greater than the maximum amount of
* memory that can be requested from malloc.
*/
}
else if (cb == 0) else if (cb == 0)
return logclose(image, f, image->file_name, return logclose(image, f, image->file_name,
": zero length: "); ": zero length: ");