[libpng16] Don't warn about invalid dimensions exceeding user limits.

This commit is contained in:
Cosmin Truta 2014-03-22 09:39:33 -05:00 committed by Glenn Randers-Pehrson
parent 82200daec2
commit ae6eaa89e5
3 changed files with 34 additions and 31 deletions

View File

@ -38,6 +38,7 @@ Version 1.6.11beta02 [March 22, 2014]
Silence 'unused parameter' build warnings (Cosmin).
$(CP) is now used alongside $(RM_F). Also, use 'copy' instead
of 'cp' where applicable, and applied other minor makefile changes.
Don't warn about invalid dimensions exceeding user limits.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4887,6 +4887,7 @@ Version 1.6.11beta02 [March 22, 2014]
Silence 'unused parameter' build warnings (Cosmin).
$(CP) is now used alongside $(RM_F). Also, use 'copy' instead
of 'cp' where applicable, and applied other minor makefile changes.
Don't warn about invalid dimensions exceeding user limits.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

37
png.c
View File

@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.6.11beta02 - March 17, 2014" PNG_STRING_NEWLINE \
"libpng version 1.6.11beta02 - March 22, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
return "libpng version 1.6.11beta02 - March 17, 2014\
return "libpng version 1.6.11beta02 - March 22, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -2435,16 +2435,15 @@ png_check_IHDR(png_const_structrp png_ptr,
png_warning(png_ptr, "Image width is zero in IHDR");
error = 1;
}
if (height == 0)
else if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Image height is zero in IHDR");
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
else
{
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max)
# else
if (width > PNG_USER_WIDTH_MAX)
# endif
@ -2452,7 +2451,20 @@ png_check_IHDR(png_const_structrp png_ptr,
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
error = 1;
}
}
if (height == 0)
{
png_warning(png_ptr, "Image height is zero in IHDR");
error = 1;
}
else if (height > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image height in IHDR");
error = 1;
}
else
{
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max)
# else
@ -2462,17 +2474,6 @@ png_check_IHDR(png_const_structrp png_ptr,
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
}
if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
if (height > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image height in IHDR");
error = 1;
}
/* Check other values */