Re: cvs: php-src /ext/json JSON_parser.c

From: Date: Tue, 17 Mar 2009 22:32:05 +0000
Subject: Re: cvs: php-src /ext/json JSON_parser.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-56584@lists.php.net to get a copy of this message
Just forgetfulness with PHP 5.2, I'll get it applied soon. Scott On 17 Mar 2009, at 20:15, Matt Wilmas wrote:
Hi Scott, Didn't get to send a message before you corrected the decoding, but was going to suggest the method for long vs double checking that's used in the scanner, is_numeric_string(), etc. (and I'm about to add a couple more). It saves from using both strto* functions. :-) See the attached patch against HEAD. I guess I could go ahead and do it later anyway, since your change didn't get merged to 5.2? - Matt ----- Original Message ----- From: "Scott MacVicar" Sent: Tuesday, March 17, 2009
scottmac Tue Mar 17 14:56:49 2009 UTC Modified files: /php-src/ext/json JSON_parser.c Log: Deal with overflow when decoding large numbers http://cvs.php.net/viewvc.cgi/php-src/ext/json/JSON_parser.c?r1=1.23&r2=1.24&diff_format=u Index: php-src/ext/json/JSON_parser.c diff -u php-src/ext/json/JSON_parser.c:1.23 php-src/ext/json/JSON_parser.c:1.24 --- php-src/ext/json/JSON_parser.c:1.23 Tue Mar 17 02:00:08 2009 +++ php-src/ext/json/JSON_parser.c Tue Mar 17 14:56:49 2009 @@ -290,8 +290,9 @@ if (type == IS_LONG) { long l = strtol(buf->c, NULL, 10); - if (l > LONG_MAX || l < LONG_MIN) { - ZVAL_DOUBLE(*z, zend_strtod(buf->c, NULL)); + double d = zend_strtod(buf->c, NULL); + if (d > LONG_MAX || d < LONG_MIN) { + ZVAL_DOUBLE(*z, d); } else { ZVAL_LONG(*z, l); }
<json_numbers.diff.txt>


« previous php.cvs (#56584) next »