From 0c0659dc50dc17b267072f95c6e1ebddcc91e82d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 19 Jun 2019 13:18:23 +0200 Subject: [PATCH] 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. --- ext/standard/math.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/math.c b/ext/standard/math.c index 840df9103e..5172bbbd6e 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -129,7 +129,7 @@ PHPAPI double _php_math_round(double value, int places, int mode) { double tmp_value; int precision_places; - if (!zend_finite(value)) { + if (!zend_finite(value) || value == 0.0) { return value; } -- 2.50.1