From: Nikita Popov Date: Wed, 19 Jun 2019 11:18:23 +0000 (+0200) Subject: Fix _php_math_round UB X-Git-Tag: php-7.4.0alpha2~51^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c0659dc50dc17b267072f95c6e1ebddcc91e82d;p=php 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. --- 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; }