com php-src: Bug #71201 round() segfault on 64-bit builds: ext/standard/math.c

From: Date: Wed, 23 Dec 2015 17:16:52 +0000
Subject: com php-src: Bug #71201 round() segfault on 64-bit builds: ext/standard/math.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90426@lists.php.net to get a copy of this message
Commit: 0d822f6df946764f3f0348b82efae2e1eaa83aa0 Author: Anatol Belski <ab@php.net> Wed, 23 Dec 2015 18:16:52 +0100 Parents: 620ccc9b1a0a593786a364af15d45fd797a6cf1f Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0d822f6df946764f3f0348b82efae2e1eaa83aa0 Log: Bug #71201 round() segfault on 64-bit builds Bugs: https://bugs.php.net/71201 Changed paths: M ext/standard/math.c Diff: diff --git a/ext/standard/math.c b/ext/standard/math.c index 59bd834..e004173 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -353,7 +353,15 @@ PHP_FUNCTION(round) } if (ZEND_NUM_ARGS() >= 2) { - places = (int) precision; +#if SIZEOF_LONG > SIZEOF_INT + if (precision >= 0) { + places = precision > INT_MAX ? INT_MAX : (int)precision; + } else { + places = precision <= INT_MIN ? INT_MIN+1 : (int)precision; + } +#else + places = precision; +#endif } convert_scalar_to_number_ex(value);

« previous php.cvs (#90426) next »