diff options
author | Scott MacVicar <scottmac@php.net> | 2009-03-17 14:57:39 +0000 |
---|---|---|
committer | Scott MacVicar <scottmac@php.net> | 2009-03-17 14:57:39 +0000 |
commit | 3a0c86327f891a3d150bc8165d5ec86d09bc94a8 (patch) | |
tree | 1252c5e9cc17f7355e6e01756afdf2d062480801 /ext/json/JSON_parser.c | |
parent | dec9e1910c54c158d8a4704cdab76a235e9fba49 (diff) | |
download | php-git-3a0c86327f891a3d150bc8165d5ec86d09bc94a8.tar.gz |
MFH Deal with overflow when decoding large numbers
Diffstat (limited to 'ext/json/JSON_parser.c')
-rw-r--r-- | ext/json/JSON_parser.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 8eaf65e85c..7125012610 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -290,8 +290,9 @@ static void json_create_zval(zval **z, smart_str *buf, int type) 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); } |