cvs: php-src(PHP_5_2) / NEWS /ext/json json.c /ext/json/tests bug40503.phpt

From: Date: Sun, 18 Feb 2007 16:54:59 +0000
Subject: cvs: php-src(PHP_5_2) / NEWS /ext/json json.c /ext/json/tests bug40503.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-43115@lists.php.net to get a copy of this message
iliaa Sun Feb 18 16:54:59 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/json/tests bug40503.phpt Modified files: /php-src NEWS /php-src/ext/json json.c Log: Fixed bug #40503 (json_encode() value corruption on 32bit systems with overflown values). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.545&r2=1.2027.2.547.2.546&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.545 php-src/NEWS:1.2027.2.547.2.546 --- php-src/NEWS:1.2027.2.547.2.545 Fri Feb 16 11:30:03 2007 +++ php-src/NEWS Sun Feb 18 16:54:59 2007 @@ -6,6 +6,8 @@ - Add --ri switch to CLI which allows to check extension information. (Marcus) - Added tidyNode::getParent() method (John, Nuno) - Fixed zend_llist_remove_tail (Michael Wallner, Dmitry) +- Fixed bug #40503 (json_encode() value corruption on 32bit systems with + overflown values). (Ilia) - Fixed bug #40467 (Partial SOAP request sent when XSD sequence or choice include minOccurs=0). (Dmitry) - Fixed bug #40465 (Ensure that all PHP elements are printed by var_dump). http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.11&r2=1.9.2.12&diff_format=u Index: php-src/ext/json/json.c diff -u php-src/ext/json/json.c:1.9.2.11 php-src/ext/json/json.c:1.9.2.12 --- php-src/ext/json/json.c:1.9.2.11 Fri Jan 12 12:17:32 2007 +++ php-src/ext/json/json.c Sun Feb 18 16:54:59 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: json.c,v 1.9.2.11 2007/01/12 12:17:32 tony2001 Exp $ */ +/* $Id: json.c,v 1.9.2.12 2007/02/18 16:54:59 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -345,7 +345,7 @@ } break; case IS_LONG: - smart_str_append_long(buf, Z_LVAL_P(val)); + smart_str_append_long(buf, Z_LVAL_P(val)); break; case IS_DOUBLE: { @@ -353,14 +353,16 @@ int len; double dbl = Z_DVAL_P(val); - if (!zend_isinf(dbl) && !zend_isnan(dbl)) - { - len = spprintf(&d, 0, "%.9g", dbl); - if (d) - { - smart_str_appendl(buf, d, len); - efree(d); - } + if (!zend_isinf(dbl) && !zend_isnan(dbl)) { + len = spprintf(&d, 0, "%.9g", dbl); + if (d) { + if (dbl > LONG_MAX && !memchr(d, '.', len)) { + smart_str_append_unsigned(buf, (unsigned long)Z_DVAL_P(val)); + } else { + smart_str_appendl(buf, d, len); + } + efree(d); + } } else { http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug40503.phpt?view=markup&rev=1.1 Index: php-src/ext/json/tests/bug40503.phpt +++ php-src/ext/json/tests/bug40503.phpt

« previous php.cvs (#43115) next »