Skip to content

Commit 0a6291b

Browse files
committed
Merge branch 'PHP-7.4'
2 parents f2f3134 + 0508a70 commit 0a6291b

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
@@ -2271,14 +2271,11 @@ static void exif_iif_free(image_info_type *image_info, int section_index) {
22712271
efree(f);
22722272
}
22732273
switch(image_info->info_list[section_index].list[i].format) {
2274+
case TAG_FMT_UNDEFINED:
2275+
case TAG_FMT_STRING:
22742276
case TAG_FMT_SBYTE:
22752277
case TAG_FMT_BYTE:
2276-
/* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */
2277-
if (image_info->info_list[section_index].list[i].length<1)
2278-
break;
22792278
default:
2280-
case TAG_FMT_UNDEFINED:
2281-
case TAG_FMT_STRING:
22822279
if ((f=image_info->info_list[section_index].list[i].value.s) != NULL) {
22832280
efree(f);
22842281
}
@@ -3433,9 +3430,11 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
34333430
break;
34343431

34353432
case TAG_MAKE:
3433+
EFREE_IF(ImageInfo->make);
34363434
ImageInfo->make = estrndup(value_ptr, byte_count);
34373435
break;
34383436
case TAG_MODEL:
3437+
EFREE_IF(ImageInfo->model);
34393438
ImageInfo->model = estrndup(value_ptr, byte_count);
34403439
break;
34413440

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)