com php-src: Avoid overflow UB in is_numeric_string: Ze nd/zend_operators.c

From: Date: Wed, 19 Jun 2019 13:09:00 +0000
Subject: com php-src: Avoid overflow UB in is_numeric_string: Ze nd/zend_operators.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106901@lists.php.net to get a copy of this message
Commit: 82a34e71c59010b64cf0104789da66d0c4d26b9c Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 19 Jun 2019 12:53:10 +0200 Parents: 3d4298697b41231690f93590e99f599b964f6a0d Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=82a34e71c59010b64cf0104789da66d0c4d26b9c Log: Avoid overflow UB in is_numeric_string We intentionally overflow the signed space here, so make this an unsigned variable and only cast to signed at the end. Changed paths: M Zend/zend_operators.c Diff: diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 6033faf..3848849 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -3035,7 +3035,7 @@ ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t int digits = 0, dp_or_e = 0; double local_dval = 0.0; zend_uchar type; - zend_long tmp_lval = 0; + zend_ulong tmp_lval = 0; int neg = 0; if (!length) { @@ -3143,7 +3143,7 @@ process_double: if (neg) { tmp_lval = -tmp_lval; } - *lval = tmp_lval; + *lval = (zend_long) tmp_lval; } return IS_LONG;

« previous php.cvs (#106901) next »