Fix leak of temporary buffer during exif tag reading

This commit is contained in:
Nikita Popov 2019-09-22 12:10:17 +02:00
parent 0701835c01
commit f989a4cd44
3 changed files with 12 additions and 0 deletions

View File

@ -3588,9 +3588,11 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
Subdir_start = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel);
if (Subdir_start < offset_base || Subdir_start > offset_base+IFDlength) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD Pointer");
EFREE_IF(outside);
return FALSE;
}
if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index, tag)) {
EFREE_IF(outside);
return FALSE;
}
#ifdef EXIF_DEBUG

Binary file not shown.

View File

@ -0,0 +1,10 @@
--TEST--
OSS-Fuzz: Temporary buffer leak in tag reading
--FILE--
<?php
var_dump(@exif_read_data(__DIR__ . '/temporary_buffer_leak.jpg'));
?>
--EXPECT--
bool(false)