summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2019-12-16 10:05:02 -0800
committerDerick Rethans <github@derickrethans.nl>2019-12-17 16:18:13 +0000
commit0ab9da70b57977c715dc4d2a400a1ea3f00af0ce (patch)
tree3d17f0655964238c9c0435507aebdeae70670827
parentaa3bb910721cc7e08079e20b9f914a7d684832ee (diff)
downloadphp-git-0ab9da70b57977c715dc4d2a400a1ea3f00af0ce.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix test Fix bug #78793
-rw-r--r--ext/exif/exif.c5
-rw-r--r--ext/exif/tests/bug78793.phpt12
2 files changed, 15 insertions, 2 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index f9320df6b4..831e08dd6f 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -3206,8 +3206,9 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
}
for (de=0;de<NumDirEntries;de++) {
- if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
- offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
+ size_t offset = 2 + 12 * de;
+ if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset,
+ offset_base, data_len - offset, displacement, section_index, 0, maker_note->tag_table)) {
return FALSE;
}
}
diff --git a/ext/exif/tests/bug78793.phpt b/ext/exif/tests/bug78793.phpt
new file mode 100644
index 0000000000..033f255ace
--- /dev/null
+++ b/ext/exif/tests/bug78793.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #78793: Use-after-free in exif parsing under memory sanitizer
+--FILE--
+<?php
+$f = "ext/exif/tests/bug77950.tiff";
+for ($i = 0; $i < 10; $i++) {
+ @exif_read_data($f);
+}
+?>
+===DONE===
+--EXPECT--
+===DONE===