Skip to content

Commit d348cfb

Browse files
committed
Fixed bug #78910
1 parent eb23c60 commit d348cfb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

ext/exif/exif.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
31653165
continue;
31663166
if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model)))
31673167
continue;
3168-
if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
3168+
if (maker_note->id_string && value_len >= maker_note->id_string_len
3169+
&& strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
31693170
continue;
31703171
break;
31713172
}

ext/exif/tests/bug78910.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #78910: Heap-buffer-overflow READ in exif (OSS-Fuzz #19044)
3+
--FILE--
4+
<?php
5+
6+
var_dump(exif_read_data('data:image/jpg;base64,TU0AKgAAAAwgICAgAAIBDwAEAAAAAgAAACKSfCAgAAAAAEZVSklGSUxN'));
7+
8+
?>
9+
--EXPECTF--
10+
Notice: exif_read_data(): Read from TIFF: tag(0x927C, MakerNote ): Illegal format code 0x2020, switching to BYTE in %s on line %d
11+
12+
Warning: exif_read_data(): Process tag(x927C=MakerNote ): Illegal format code 0x2020, suppose BYTE in %s on line %d
13+
14+
Warning: exif_read_data(): IFD data too short: 0x0000 offset 0x000C in %s on line %d
15+
16+
Warning: exif_read_data(): Invalid TIFF file in %s on line %d
17+
bool(false)

0 commit comments

Comments
 (0)