[devel] Allow png_set_user_limits() to increase limits as well as reduce them.

This commit is contained in:
Glenn Randers-Pehrson 2011-06-11 14:20:22 -05:00
parent 6f55ee2ec5
commit b704036531
2 changed files with 6 additions and 4 deletions

View File

@ -3419,9 +3419,11 @@ Version 1.5.3rc02 [June 8, 2011]
Version 1.5.3beta11 [June 11, 2011] Version 1.5.3beta11 [June 11, 2011]
Fixed png_handle_sCAL which is broken in 1.5; added sCAL to pngtest.png Fixed png_handle_sCAL which is broken in 1.5; added sCAL to pngtest.png
Revised documentation about png_set_user_limits() to say that it can Revised documentation about png_set_user_limits() to say that it also affects
only be used to reduce the defined limit, and that it also affects
png writing. png writing.
Revised handling of png_set_user_limits() so that it can increase the
limit beyond the PNG_USER_WIDTH|HEIGHT_MAX; previously it could only
reduce it.
Make the 16-to-8 scaling accurate. Dividing by 256 with no rounding is Make the 16-to-8 scaling accurate. Dividing by 256 with no rounding is
wrong (high by one) 25% of the time. Dividing by 257 with rounding is wrong (high by one) 25% of the time. Dividing by 257 with rounding is
wrong in 128 out of 65536 cases. Getting the right answer all the time wrong in 128 out of 65536 cases. Getting the right answer all the time

4
png.c
View File

@ -820,7 +820,7 @@ png_check_IHDR(png_structp png_ptr,
} }
# ifdef PNG_SET_USER_LIMITS_SUPPORTED # ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max || width > PNG_USER_WIDTH_MAX) if (width > png_ptr->user_width_max)
# else # else
if (width > PNG_USER_WIDTH_MAX) if (width > PNG_USER_WIDTH_MAX)
@ -831,7 +831,7 @@ png_check_IHDR(png_structp png_ptr,
} }
# ifdef PNG_SET_USER_LIMITS_SUPPORTED # ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max || height > PNG_USER_HEIGHT_MAX) if (height > png_ptr->user_height_max)
# else # else
if (height > PNG_USER_HEIGHT_MAX) if (height > PNG_USER_HEIGHT_MAX)
# endif # endif