diff options
Diffstat (limited to 'ext/standard/math.c')
-rw-r--r-- | ext/standard/math.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c index 6f7bede332..ed367823ed 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -929,9 +929,10 @@ PHPAPI zend_string * _php_math_longtobase(zval *arg, int base) *ptr = '\0'; do { + ZEND_ASSERT(ptr > buf); *--ptr = digits[value % base]; value /= base; - } while (ptr > buf && value); + } while (value); return zend_string_init(ptr, end - ptr, 0); } @@ -1193,7 +1194,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin * we requested due to internal buffer limitations */ if (dec) { size_t declen = (dp ? s - dp : 0); - size_t topad = dec > declen ? dec - declen : 0; + size_t topad = (size_t)dec > declen ? dec - declen : 0; /* pad with '0's */ while (topad--) { |