Skip to content

Commit

Permalink
[libpng16] Avoid possible NULL dereference in png_handle_eXIf when be…
Browse files Browse the repository at this point in the history
…nign_errors

are allowed. Avoid leaking the input buffer "eXIf_buf".
  • Loading branch information
Glenn Randers-Pehrson committed Jul 31, 2017
1 parent b73c891 commit 4ab78af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ANNOUNCE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Libpng 1.6.32beta01 - July 27, 2017
Libpng 1.6.32beta01 - July 31, 2017

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.
Expand All @@ -25,7 +25,9 @@ Other information:

Changes since the last public release (1.6.31):

Version 1.6.32beta01 [July 27, 2017]
Version 1.6.32beta01 [July 31, 2017]
Avoid possible NULL dereference in png_handle_eXIf when benign_errors
are allowed. Avoid leaking the input buffer "eXIf_buf".

Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
Expand Down
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -5908,7 +5908,9 @@ Version 1.6.31rc02 [July 25, 2017]
Version 1.6.31 [July 27, 2017]
No changes.

Version 1.6.32beta01 [July 27, 2017]
Version 1.6.32beta01 [July 31, 2017]
Avoid possible NULL dereference in png_handle_eXIf when benign_errors
are allowed. Avoid leaking the input buffer "eXIf_buf".

Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
Expand Down
4 changes: 3 additions & 1 deletion pngrutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");

else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_eXIf) != 0)
else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "duplicate");
Expand All @@ -2044,6 +2044,8 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
info_ptr->num_exif = length;

png_set_eXIf(png_ptr, info_ptr, eXIf_buf);

png_free(png_ptr, eXIf_buf);
}
#endif

Expand Down

0 comments on commit 4ab78af

Please sign in to comment.