@@ -981,6 +981,9 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
981
981
&& (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_STRING )) {
982
982
return 0 ;
983
983
}
984
+ if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
985
+ return 0 ;
986
+ }
984
987
return 1 ;
985
988
} else if (opline -> opcode == ZEND_ASSIGN_OP
986
989
&& (opline -> extended_value == ZEND_ADD
@@ -991,18 +994,25 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
991
994
&& (tssa -> var_info [tssa -> ops [idx ].op2_use ].type & MAY_BE_REF )) {
992
995
return 0 ;
993
996
}
997
+ if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
998
+ return 0 ;
999
+ }
1000
+ if (opline -> op2_type == IS_CONST ) {
1001
+ zval * zv = RT_CONSTANT (opline , opline -> op2 );
1002
+ if (Z_TYPE_P (zv ) != IS_LONG && Z_TYPE_P (zv ) != IS_DOUBLE ) {
1003
+ return 0 ;
1004
+ }
1005
+ } else if (!(tssa -> var_info [tssa -> ops [idx ].op2_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1006
+ return 0 ;
1007
+ }
994
1008
return 1 ;
995
1009
}
996
1010
}
997
1011
if (tssa -> ops [idx ].result_def == var ) {
998
1012
const zend_op * opline = ssa_opcodes [idx ];
999
1013
if (opline -> opcode == ZEND_ADD
1000
1014
|| opline -> opcode == ZEND_SUB
1001
- || opline -> opcode == ZEND_MUL
1002
- || opline -> opcode == ZEND_PRE_DEC
1003
- || opline -> opcode == ZEND_PRE_INC
1004
- || opline -> opcode == ZEND_POST_DEC
1005
- || opline -> opcode == ZEND_POST_INC ) {
1015
+ || opline -> opcode == ZEND_MUL ) {
1006
1016
if ((opline -> op1_type & (IS_VAR |IS_CV ))
1007
1017
&& tssa -> ops [idx ].op1_use >= 0
1008
1018
&& (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_REF )) {
@@ -1013,6 +1023,34 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
1013
1023
&& (tssa -> var_info [tssa -> ops [idx ].op2_use ].type & MAY_BE_REF )) {
1014
1024
return 0 ;
1015
1025
}
1026
+ if (opline -> op1_type == IS_CONST ) {
1027
+ zval * zv = RT_CONSTANT (opline , opline -> op1 );
1028
+ if (Z_TYPE_P (zv ) != IS_LONG && Z_TYPE_P (zv ) != IS_DOUBLE ) {
1029
+ return 0 ;
1030
+ }
1031
+ } else if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1032
+ return 0 ;
1033
+ }
1034
+ if (opline -> op2_type == IS_CONST ) {
1035
+ zval * zv = RT_CONSTANT (opline , opline -> op2 );
1036
+ if (Z_TYPE_P (zv ) != IS_LONG && Z_TYPE_P (zv ) != IS_DOUBLE ) {
1037
+ return 0 ;
1038
+ }
1039
+ } else if (!(tssa -> var_info [tssa -> ops [idx ].op2_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1040
+ return 0 ;
1041
+ }
1042
+ } else if (opline -> opcode == ZEND_PRE_DEC
1043
+ || opline -> opcode == ZEND_PRE_INC
1044
+ || opline -> opcode == ZEND_POST_DEC
1045
+ || opline -> opcode == ZEND_POST_INC ) {
1046
+ if ((opline -> op1_type & (IS_VAR |IS_CV ))
1047
+ && tssa -> ops [idx ].op1_use >= 0
1048
+ && (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_REF )) {
1049
+ return 0 ;
1050
+ }
1051
+ if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1052
+ return 0 ;
1053
+ }
1016
1054
return 1 ;
1017
1055
}
1018
1056
}
0 commit comments