Skip to content

Commit bbde9c8

Browse files
committed
Fix OSS-Fuzz #478009707 for JIT
This issue was already fixed in GH-21124, but some JIT paths were missing. Closes GH-21151
1 parent ee26417 commit bbde9c8

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Zend/tests/oss-fuzz-478009707.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ $c = new C(1);
1818
$c->prop = 1;
1919
var_dump($c->prop);
2020

21+
$c->prop = PHP_INT_MAX;
22+
var_dump($c->prop);
23+
2124
?>
22-
--EXPECT--
25+
--EXPECTF--
2326
int(4)
27+
float(%s)

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ static void ZEND_FASTCALL zend_jit_assign_obj_op_helper(zend_object *zobj, zend_
27762776
//??? } else {
27772777
//??? prop_info = zend_object_fetch_property_type_info(Z_OBJ_P(object), orig_zptr);
27782778
//??? }
2779-
if (prop_info) {
2779+
if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
27802780
/* special case for typed properties */
27812781
zend_jit_assign_op_to_typed_prop(zptr, prop_info, value, binary_op);
27822782
} else {
@@ -2972,6 +2972,9 @@ static void ZEND_FASTCALL zend_jit_pre_inc_obj_helper(zend_object *zobj, zend_st
29722972
}
29732973
} else {
29742974
zend_property_info *prop_info = (zend_property_info *) CACHED_PTR_EX(cache_slot + 2);
2975+
if (prop_info && !ZEND_TYPE_IS_SET(prop_info->type)) {
2976+
prop_info = NULL;
2977+
}
29752978

29762979
if (EXPECTED(Z_TYPE_P(prop) == IS_LONG)) {
29772980
fast_long_increment_function(prop);
@@ -3042,6 +3045,9 @@ static void ZEND_FASTCALL zend_jit_pre_dec_obj_helper(zend_object *zobj, zend_st
30423045
}
30433046
} else {
30443047
zend_property_info *prop_info = (zend_property_info *) CACHED_PTR_EX(cache_slot + 2);
3048+
if (prop_info && !ZEND_TYPE_IS_SET(prop_info->type)) {
3049+
prop_info = NULL;
3050+
}
30453051

30463052
if (EXPECTED(Z_TYPE_P(prop) == IS_LONG)) {
30473053
fast_long_decrement_function(prop);
@@ -3110,6 +3116,9 @@ static void ZEND_FASTCALL zend_jit_post_inc_obj_helper(zend_object *zobj, zend_s
31103116
ZVAL_NULL(result);
31113117
} else {
31123118
zend_property_info *prop_info = (zend_property_info*)CACHED_PTR_EX(cache_slot + 2);
3119+
if (prop_info && !ZEND_TYPE_IS_SET(prop_info->type)) {
3120+
prop_info = NULL;
3121+
}
31133122

31143123
if (EXPECTED(Z_TYPE_P(prop) == IS_LONG)) {
31153124
ZVAL_LONG(result, Z_LVAL_P(prop));
@@ -3171,6 +3180,9 @@ static void ZEND_FASTCALL zend_jit_post_dec_obj_helper(zend_object *zobj, zend_s
31713180
ZVAL_NULL(result);
31723181
} else {
31733182
zend_property_info *prop_info = (zend_property_info*)CACHED_PTR_EX(cache_slot + 2);
3183+
if (prop_info && !ZEND_TYPE_IS_SET(prop_info->type)) {
3184+
prop_info = NULL;
3185+
}
31743186

31753187
if (EXPECTED(Z_TYPE_P(prop) == IS_LONG)) {
31763188
ZVAL_LONG(result, Z_LVAL_P(prop));

0 commit comments

Comments
 (0)