Skip to content

Commit 623d897

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 33e556f + 0701835 commit 623d897

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
@@ -2297,14 +2297,11 @@ static void exif_iif_free(image_info_type *image_info, int section_index) {
22972297
efree(f);
22982298
}
22992299
switch(image_info->info_list[section_index].list[i].format) {
2300+
case TAG_FMT_UNDEFINED:
2301+
case TAG_FMT_STRING:
23002302
case TAG_FMT_SBYTE:
23012303
case TAG_FMT_BYTE:
2302-
/* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */
2303-
if (image_info->info_list[section_index].list[i].length<1)
2304-
break;
23052304
default:
2306-
case TAG_FMT_UNDEFINED:
2307-
case TAG_FMT_STRING:
23082305
if ((f=image_info->info_list[section_index].list[i].value.s) != NULL) {
23092306
efree(f);
23102307
}
@@ -3516,9 +3513,11 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
35163513
break;
35173514

35183515
case TAG_MAKE:
3516+
EFREE_IF(ImageInfo->make);
35193517
ImageInfo->make = estrndup(value_ptr, byte_count);
35203518
break;
35213519
case TAG_MODEL:
3520+
EFREE_IF(ImageInfo->model);
35223521
ImageInfo->model = estrndup(value_ptr, byte_count);
35233522
break;
35243523

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)