Skip to content

Commit 0c0659d

Browse files
committed
Fix _php_math_round UB
php_intlog10abs() is ill-defined for a zero value. Avoid calling it altogether as there's nothing to round with a zero value.
1 parent 317dfab commit 0c0659d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/math.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ PHPAPI double _php_math_round(double value, int places, int mode) {
129129
double tmp_value;
130130
int precision_places;
131131

132-
if (!zend_finite(value)) {
132+
if (!zend_finite(value) || value == 0.0) {
133133
return value;
134134
}
135135

0 commit comments

Comments
 (0)