mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] 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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user