@@ -1082,6 +1082,9 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
1082
1082
&& (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_STRING )) {
1083
1083
return 0 ;
1084
1084
}
1085
+ if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1086
+ return 0 ;
1087
+ }
1085
1088
return 1 ;
1086
1089
} else if (opline -> opcode == ZEND_ASSIGN_OP
1087
1090
&& (opline -> extended_value == ZEND_ADD
@@ -1110,11 +1113,7 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
1110
1113
const zend_op * opline = ssa_opcodes [idx ];
1111
1114
if (opline -> opcode == ZEND_ADD
1112
1115
|| opline -> opcode == ZEND_SUB
1113
- || opline -> opcode == ZEND_MUL
1114
- || opline -> opcode == ZEND_PRE_DEC
1115
- || opline -> opcode == ZEND_PRE_INC
1116
- || opline -> opcode == ZEND_POST_DEC
1117
- || opline -> opcode == ZEND_POST_INC ) {
1116
+ || opline -> opcode == ZEND_MUL ) {
1118
1117
if ((opline -> op1_type & (IS_VAR |IS_CV ))
1119
1118
&& tssa -> ops [idx ].op1_use >= 0
1120
1119
&& (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_REF )) {
@@ -1125,6 +1124,34 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
1125
1124
&& (tssa -> var_info [tssa -> ops [idx ].op2_use ].type & MAY_BE_REF )) {
1126
1125
return 0 ;
1127
1126
}
1127
+ if (opline -> op1_type == IS_CONST ) {
1128
+ zval * zv = RT_CONSTANT (opline , opline -> op1 );
1129
+ if (Z_TYPE_P (zv ) != IS_LONG && Z_TYPE_P (zv ) != IS_DOUBLE ) {
1130
+ return 0 ;
1131
+ }
1132
+ } else if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1133
+ return 0 ;
1134
+ }
1135
+ if (opline -> op2_type == IS_CONST ) {
1136
+ zval * zv = RT_CONSTANT (opline , opline -> op2 );
1137
+ if (Z_TYPE_P (zv ) != IS_LONG && Z_TYPE_P (zv ) != IS_DOUBLE ) {
1138
+ return 0 ;
1139
+ }
1140
+ } else if (!(tssa -> var_info [tssa -> ops [idx ].op2_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1141
+ return 0 ;
1142
+ }
1143
+ } else if (opline -> opcode == ZEND_PRE_DEC
1144
+ || opline -> opcode == ZEND_PRE_INC
1145
+ || opline -> opcode == ZEND_POST_DEC
1146
+ || opline -> opcode == ZEND_POST_INC ) {
1147
+ if ((opline -> op1_type & (IS_VAR |IS_CV ))
1148
+ && tssa -> ops [idx ].op1_use >= 0
1149
+ && (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_REF )) {
1150
+ return 0 ;
1151
+ }
1152
+ if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1153
+ return 0 ;
1154
+ }
1128
1155
return 1 ;
1129
1156
}
1130
1157
}
0 commit comments