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

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

View File

@@ -1,5 +1,5 @@
Libpng 1.7.0beta43 - December 15, 2014 Libpng 1.7.0beta43 - 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.
@@ -658,11 +658,12 @@ Version 1.7.0beta42 [November 20, 2014]
Merged clang no-warning fix from libpng-1.6.13: png_digit was defined Merged clang no-warning fix from libpng-1.6.13: png_digit was defined
but never used in pngerror.c. but never used in pngerror.c.
Version 1.7.0beta43 [December 15, 2014] Version 1.7.0beta43 [December 17, 2014]
Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
don't do alignment correctly. don't do alignment correctly.
Revised Makefile.am and scripts/*.dfn to work with MinGW/MSYS; Revised Makefile.am and scripts/*.dfn to work with MinGW/MSYS;
renamed scripts/*.dfn to scripts/*.c (Bob Friesenhahn and John Bowler). renamed scripts/*.dfn to scripts/*.c (Bob Friesenhahn and John Bowler).
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

@@ -4947,11 +4947,12 @@ Version 1.7.0beta42 [November 20, 2014]
Merged clang no-warning fix from libpng-1.6.13: png_digit was defined Merged clang no-warning fix from libpng-1.6.13: png_digit was defined
but never used in pngerror.c. but never used in pngerror.c.
Version 1.7.0beta43 [December 15, 2014] Version 1.7.0beta43 [December 17, 2014]
Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
don't do alignment correctly. don't do alignment correctly.
Revised Makefile.am and scripts/*.dfn to work with MinGW/MSYS; Revised Makefile.am and scripts/*.dfn to work with MinGW/MSYS;
renamed scripts/*.dfn to scripts/*.c (Bob Friesenhahn and John Bowler). renamed scripts/*.dfn to scripts/*.c (Bob Friesenhahn and John Bowler).
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,32 +3173,43 @@ 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)
{ {
png_bytep b = voidcast(png_bytep, malloc((size_t)cb)); if ((unsigned long int)cb <= (size_t)~(size_t)0)
if (b != NULL)
{ {
rewind(f); png_bytep b = voidcast(png_bytep, malloc((size_t)cb));
if (fread(b, (size_t)cb, 1, f) == 1) if (b != NULL)
{ {
fclose(f); rewind(f);
image->input_memory_size = cb;
image->input_memory = b; if (fread(b, (size_t)cb, 1, f) == 1)
{
fclose(f);
image->input_memory_size = cb;
image->input_memory = b;
}
else
{
free(b);
return logclose(image, f, image->file_name,
": read failed: ");
}
} }
else else
{
free(b);
return logclose(image, f, image->file_name, return logclose(image, f, image->file_name,
": read failed: "); ": out of memory: ");
}
} }
else else
return logclose(image, f, image->file_name, return logclose(image, f, image->file_name,
": out of memory: "); ": 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)