summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-06-19 13:18:23 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-06-19 15:09:00 +0200
commit0c0659dc50dc17b267072f95c6e1ebddcc91e82d (patch)
tree4d41aa735bf9dc4c4967462a107df3609ac5e348
parent317dfab81bedd918de9cf6a9b93428a0b0f86307 (diff)
downloadphp-git-0c0659dc50dc17b267072f95c6e1ebddcc91e82d.tar.gz
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.
-rw-r--r--ext/standard/math.c2
1 files changed, 1 insertions, 1 deletions
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;
}