Skip to content

Commit 478d95a

Browse files
committed
Assert on the value types reaching sccp_values_differ()
1 parent 90d0706 commit 478d95a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎Zend/Optimizer/sccp.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,13 +1953,18 @@ static int sccp_values_differ(const void *p1, const void *p2)
19531953
const zval *a = p1;
19541954
const zval *b = p2;
19551955

1956-
if (Z_TYPE_P(a) == IS_DOUBLE && Z_TYPE_P(b) == IS_DOUBLE) {
1956+
if (Z_TYPE_P(a) != Z_TYPE_P(b)) {
1957+
return 1;
1958+
}
1959+
if (Z_TYPE_P(a) == IS_DOUBLE) {
19571960
return memcmp(&Z_DVAL_P(a), &Z_DVAL_P(b), sizeof(double)) != 0;
19581961
}
1959-
if (Z_TYPE_P(a) == IS_ARRAY && Z_TYPE_P(b) == IS_ARRAY) {
1962+
if (Z_TYPE_P(a) == IS_ARRAY) {
19601963
return Z_ARRVAL_P(a) != Z_ARRVAL_P(b)
19611964
&& zend_hash_compare(Z_ARRVAL_P(a), Z_ARRVAL_P(b), sccp_values_differ, 1) != 0;
19621965
}
1966+
ZEND_ASSERT(IS_PARTIAL_ARRAY(a) || IS_PARTIAL_OBJECT(a)
1967+
|| ((1 << Z_TYPE_P(a)) & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_BOOL|MAY_BE_LONG|MAY_BE_STRING)));
19631968
return !zend_is_identical(a, b);
19641969
}
19651970

0 commit comments

Comments
 (0)