Re: cvs: php-src /ext/json JSON_parser.c
| From: | Rasmus Lerdorf | Date: | Tue, 17 Mar 2009 15:03:01 +0000 |
| Subject: | Re: cvs: php-src /ext/json JSON_parser.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-56573@lists.php.net to get a copy of this message | ||
Does this need to go upstream to the json.org version?
Scott MacVicar wrote:
> 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);
> }
>
>
>