mirror of
https://github.com/php/php-src.git
synced 2026-10-29 18:24:57 +08:00
Fix OSS-Fuzz #562721806: Use-of-uninitialized-value in zim_Time_Duration___unserialize (#23759)
LVAL cannot be read if the type is still UNDEF. Check initialization to fix this. Randomizer doesn't have this because it uses read_property.
This commit is contained in:
1 parent
bbb345b363
commit
8de697eb08
1 file changed
+3
@@ -171,6 +171,9 @@ PHP_METHOD(Time_Duration, __unserialize)
|
||||
zval *seconds = OBJ_PROP_NUM(&duration->std, 0);
|
||||
zval *nanoseconds = OBJ_PROP_NUM(&duration->std, 1);
|
||||
zval *negative = OBJ_PROP_NUM(&duration->std, 2);
|
||||
if (Z_ISUNDEF_P(seconds) || Z_ISUNDEF_P(nanoseconds) || Z_ISUNDEF_P(negative)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Verify that both properties are positive, since the timelib_duration_ctor_static() takes unsigned. */
|
||||
if (Z_LVAL_P(seconds) < 0 || Z_LVAL_P(nanoseconds) < 0) {
|
||||
|
||||
Reference in new issue
Block a user