Skip to content

Commit ee1a7e7

Browse files
committed
Add test for HEIC iloc extent_length underflow
1 parent 472f09e commit ee1a7e7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
HEIC iloc extent_length underflow
3+
--EXTENSIONS--
4+
exif
5+
--FILE--
6+
<?php
7+
// Read valid HEIC file and patch iloc extent_length to 1
8+
$data = file_get_contents(__DIR__."/image029.heic");
9+
$data = substr_replace($data, "\x00\x00\x00\x01", 0x4f8, 4);
10+
file_put_contents(__DIR__."/heic_iloc_underflow.heic", $data);
11+
var_dump(exif_read_data(__DIR__."/heic_iloc_underflow.heic"));
12+
?>
13+
--CLEAN--
14+
<?php
15+
@unlink(__DIR__."/heic_iloc_underflow.heic");
16+
?>
17+
--EXPECTF--
18+
Warning: exif_read_data(heic_iloc_underflow.heic): Invalid HEIF file in %s on line %d
19+
bool(false)

0 commit comments

Comments
 (0)