[libpng16] Check for info_ptr == NULL early in png_read_end() so we don't need

to run all the png_handle_*() and depend on them to return if info_ptr == NULL.
This improves the performance of png_read_end(png_ptr, NULL) and makes
it more robust against future programming errors.
This commit is contained in:
Glenn Randers-Pehrson 2014-02-17 09:12:52 -06:00
parent 37b7299b60
commit 9c5a1baea5
4 changed files with 18 additions and 7 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.10beta02 - February 16, 2014
Libpng 1.6.10beta02 - February 17, 2014
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.
@ -55,7 +55,7 @@ Version 1.6.10beta01 [February 9, 2014]
and it adds corresponding code to pngimage.c to handle such options
by not attempting to test them.
Version 1.6.10beta02 [February 16, 2014]
Version 1.6.10beta02 [February 17, 2014]
Moved redefines of png_error(), png_warning(), png_chunk_error(),
and png_chunk_warning() from pngpriv.h to png.h to make them visible
to libpng-calling applications.
@ -66,6 +66,10 @@ Version 1.6.10beta02 [February 16, 2014]
compile and link on Android by using /proc/cpuinfo, and the old linux code
is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
dependencies apart from opening /proc/cpuinfo and is C90 compliant.
Check for info_ptr == NULL early in png_read_end() so we don't need to
run all the png_handle_*() and depend on them to return if info_ptr == NULL.
This improves the performance of png_read_end(png_ptr, NULL) and makes
it more robust against future programming errors.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4829,7 +4829,7 @@ Version 1.6.10beta01 [February 9, 2014]
and it adds corresponding code to pngimage.c to handle such options
by not attempting to test them.
Version 1.6.10beta02 [February 16, 2014]
Version 1.6.10beta02 [February 17, 2014]
Moved redefines of png_error(), png_warning(), png_chunk_error(),
and png_chunk_warning() from pngpriv.h to png.h to make them visible
to libpng-calling applications.
@ -4840,6 +4840,10 @@ Version 1.6.10beta02 [February 16, 2014]
compile and link on Android by using /proc/cpuinfo, and the old linux code
is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
dependencies apart from opening /proc/cpuinfo and is C90 compliant.
Check for info_ptr == NULL early in png_read_end() so we don't need to
run all the png_handle_*() and depend on them to return if info_ptr == NULL.
This improves the performance of png_read_end(png_ptr, NULL) and makes
it more robust against future programming errors.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -781,11 +781,14 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
png_uint_32 length = png_read_chunk_header(png_ptr);
png_uint_32 chunk_name = png_ptr->chunk_name;
if (chunk_name == png_IHDR)
if (chunk_name == png_IEND)
png_handle_IEND(png_ptr, info_ptr, length);
else if (chunk_name == png_IHDR)
png_handle_IHDR(png_ptr, info_ptr, length);
else if (chunk_name == png_IEND)
png_handle_IEND(png_ptr, info_ptr, length);
else if (info_ptr == NULL)
png_crc_finish(png_ptr, length);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)

View File

@ -1436,7 +1436,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
(sizeof local_buffer), &length,
profile + (sizeof profile_header), &size, 0);
/* Still expect a a buffer error because we expect
/* Still expect a buffer error because we expect
* there to be some tag data!
*/
if (size == 0)