Skip to content

Commit f53af9a

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents e65adc9 + 8509970 commit f53af9a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

ext/spl/spl_observer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,9 @@ SPL_METHOD(SplObjectStorage, unserialize)
783783

784784
--p; /* for ';' */
785785
count = Z_LVAL_P(pcount);
786+
if (count < 0) {
787+
goto outexcept;
788+
}
786789

787790
ZVAL_UNDEF(&entry);
788791
ZVAL_UNDEF(&inf);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
OSS-Fuzz: Unserializing SplObjectStorage with negative number of elements
3+
--FILE--
4+
<?php
5+
6+
$str = 'C:16:"SplObjectStorage":25:{x:i:-9223372036854775808;}';
7+
try {
8+
var_dump(unserialize($str));
9+
} catch (Exception $e) {
10+
echo $e->getMessage(), "\n";
11+
}
12+
13+
?>
14+
--EXPECT--
15+
Error at offset 24 of 25 bytes

0 commit comments

Comments
 (0)