提交 dd66f3ed 编写于 作者: G Glenn Randers-Pehrson

[devel] Revised png_check_IHDR()

to add a test for user passing a 16-bit height varible to png_get_IHDR()
which causes an overflow into the high bytes of the width variable.
上级 6076da80
......@@ -568,6 +568,7 @@ version 1.4.0beta83 [September 25, 2009]
version 1.4.0beta84 [September 30, 2009]
Fixed some inconsistent indentation in pngconf.h
Revised png_check_IHDR() to add a test for width variable less than 32-bit.
version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm.
......
......@@ -2254,6 +2254,7 @@ version 1.4.0beta83 [September 25, 2009]
version 1.4.0beta84 [September 30, 2009]
Fixed some inconsistent indentation in pngconf.h
Revised png_check_IHDR() to add a test for width variable less than 32-bit.
version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm.
......
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.4.0 [September 25, 2009]
* Last changed in libpng 1.4.0 [September 30, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
......@@ -546,13 +546,13 @@ png_get_copyright(png_structp png_ptr)
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version x 1.4.0beta84 - September 25, 2009" PNG_STRING_NEWLINE \
"libpng version x 1.4.0beta84 - September 30, 2009" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2009 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 ((png_charp) "libpng version 1.4.0beta84 - September 25, 2009\
return ((png_charp) "libpng version 1.4.0beta84 - September 30, 2009\
Copyright (c) 1998-2009 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
......@@ -790,40 +790,41 @@ png_check_IHDR(png_structp png_ptr,
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max || width > PNG_USER_WIDTH_MAX)
#else
if (width > PNG_USER_WIDTH_MAX)
#endif
{
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
if ((width >> 16) == height)
{
/* This is likely to be caused by passing consecutive addresses
* of 16-bit width and height variables to png_get_IHDR(), which
* overflowed when we tried to fill them with 31-bit data.
*/
png_warning(png_ptr, "High bytes of width == low bytes of height");
}
error = 1;
}
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max || height > PNG_USER_HEIGHT_MAX)
{
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
}
#else
if (width > PNG_USER_WIDTH_MAX
{
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
error = 1;
}
if (height > PNG_USER_HEIGHT_MAX)
#endif
{
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
}
#endif
if (height > PNG_UINT_31_MAX)
if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image height in IHDR");
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
if ( height > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image width in IHDR");
png_warning(png_ptr, "Invalid image height in IHDR");
error = 1;
}
......
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.4.0 [September 25, 2009]
* Last changed in libpng 1.4.0 [September 30, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册