Skip to content

Commit a3d0d94

Browse files
committed
Use zend_dval_to_lval() in spl_offset_convert_to_long()
Avoid fptoi UB and use the standard PHP conversion behavior.
1 parent a2bbd8f commit a3d0d94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/spl/spl_engine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ PHPAPI zend_long spl_offset_convert_to_long(zval *offset) /* {{{ */
4141
}
4242
break;
4343
case IS_DOUBLE:
44-
return (zend_long)Z_DVAL_P(offset);
44+
return zend_dval_to_lval(Z_DVAL_P(offset));
4545
case IS_LONG:
4646
return Z_LVAL_P(offset);
4747
case IS_FALSE:

0 commit comments

Comments
 (0)