Skip to content

Commit 5cb4686

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix test Fix bug #78793
2 parents b74a300 + 6d5cdda commit 5cb4686

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

ext/exif/exif.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3213,8 +3213,9 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
32133213
}
32143214

32153215
for (de=0;de<NumDirEntries;de++) {
3216-
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
3217-
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
3216+
size_t offset = 2 + 12 * de;
3217+
if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset,
3218+
offset_base, data_len - offset, displacement, section_index, 0, maker_note->tag_table)) {
32183219
return FALSE;
32193220
}
32203221
}

ext/exif/tests/bug76557.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal f
7070

7171
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
7272

73-
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > x00EE) in %sbug76557.php on line %d
73+
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > %s) in %sbug76557.php on line %d
7474

7575
Warning: exif_read_data(bug76557.jpg): File structure corrupted in %sbug76557.php on line %d
7676

ext/exif/tests/bug78793.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Bug #78793: Use-after-free in exif parsing under memory sanitizer
3+
--FILE--
4+
<?php
5+
$f = "ext/exif/tests/bug77950.tiff";
6+
for ($i = 0; $i < 10; $i++) {
7+
@exif_read_data($f);
8+
}
9+
?>
10+
===DONE===
11+
--EXPECT--
12+
===DONE===

0 commit comments

Comments
 (0)