Skip to content

Commit 0508a70

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents f5b9cc4 + 623d897 commit 0508a70

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

ext/exif/exif.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,14 +2296,11 @@ static void exif_iif_free(image_info_type *image_info, int section_index) {
22962296
efree(f);
22972297
}
22982298
switch(image_info->info_list[section_index].list[i].format) {
2299+
case TAG_FMT_UNDEFINED:
2300+
case TAG_FMT_STRING:
22992301
case TAG_FMT_SBYTE:
23002302
case TAG_FMT_BYTE:
2301-
/* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */
2302-
if (image_info->info_list[section_index].list[i].length<1)
2303-
break;
23042303
default:
2305-
case TAG_FMT_UNDEFINED:
2306-
case TAG_FMT_STRING:
23072304
if ((f=image_info->info_list[section_index].list[i].value.s) != NULL) {
23082305
efree(f);
23092306
}
@@ -3458,9 +3455,11 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
34583455
break;
34593456

34603457
case TAG_MAKE:
3458+
EFREE_IF(ImageInfo->make);
34613459
ImageInfo->make = estrndup(value_ptr, byte_count);
34623460
break;
34633461
case TAG_MODEL:
3462+
EFREE_IF(ImageInfo->model);
34643463
ImageInfo->model = estrndup(value_ptr, byte_count);
34653464
break;
34663465

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
OSS-Fuzz: Memory leak for zero-length MAKERNOTE
3+
--FILE--
4+
<?php
5+
6+
@exif_read_data(__DIR__ . '/zero_length_makernote_leak.tiff');
7+
8+
?>
9+
===DONE===
10+
--EXPECT--
11+
===DONE===
164 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)