dmitry Mon Dec 24 18:09:50 2007 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2 zend_operators.c /ZendEngine2/tests int_overflow_64bit.phpt /php-src/ext/standard string.c /php-src/ext/standard/tests/strings chunk_split_error.phpt chunk_split_variation5.phpt chunk_split_variation8.phpt htmlspecialchars_decode_variation2.phpt Log: Additional fix for bug #42868
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.208.2.4.2.23.2.4&r2=1.208.2.4.2.23.2.5&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.4 ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.5 --- ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.4 Mon Dec 17 10:02:13 2007 +++ ZendEngine2/zend_operators.c Mon Dec 24 18:09:50 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.4 2007/12/17 10:02:13 dmitry Exp $ */ +/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.5 2007/12/24 18:09:50 dmitry Exp $ */ #include <ctype.h> @@ -186,36 +186,38 @@ #define MAX_UNSIGNED_INT ((double) LONG_MAX * 2) + 1 #ifdef _WIN64 # define DVAL_TO_LVAL(d, l) \ - if ((d) > LONG_MAX) { \ - if ((d) > MAX_UNSIGNED_INT) { \ - (l) = LONG_MAX; \ - } else { \ - (l) = (long)(unsigned long)(__int64) (d); \ - } \ - } else { \ - if((d) < LONG_MIN) { \ - (l) = LONG_MIN; \ - } else { \ - (l) = (long) (d); \ - } \ - } + if ((d) > LONG_MAX) { \ + (l) = (long)(unsigned long)(__int64) (d); \ + } else { \ + (l) = (long) (d); \ + } +#elif !defined(_WIN64) && __WORDSIZE == 64 +# define DVAL_TO_LVAL(d, l) \ + if ((d) >= LONG_MAX) { \ + (l) = LONG_MAX; \ + } else if ((d) <= LONG_MIN) { \ + (l) = LONG_MIN; \ + } else {\ + (l) = (long) (d); \ + } #else # define DVAL_TO_LVAL(d, l) \ - if ((d) > LONG_MAX) { \ - if ((d) > MAX_UNSIGNED_INT) { \ - (l) = LONG_MAX; \ - } else { \ - (l) = (unsigned long) (d); \ - } \ - } else { \ - if((d) < LONG_MIN) { \ - (l) = LONG_MIN; \ - } else { \ - (l) = (long) (d); \ - } \ - } + if ((d) > LONG_MAX) { \ + if ((d) > MAX_UNSIGNED_INT) { \ + (l) = LONG_MAX; \ + } else { \ + (l) = (unsigned long) (d); \ + } \ + } else { \ + if((d) < LONG_MIN) { \ + (l) = LONG_MIN; \ + } else { \ + (l) = (long) (d); \ + } \ + } #endif + #define zendi_convert_to_long(op, holder, result) \ if (op == result) { \ convert_to_long(op); \ http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/int_overflow_64bit.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u Index: ZendEngine2/tests/int_overflow_64bit.phpt diff -u ZendEngine2/tests/int_overflow_64bit.phpt:1.1.2.1 ZendEngine2/tests/int_overflow_64bit.phpt:1.1.2.1.2.1 --- ZendEngine2/tests/int_overflow_64bit.phpt:1.1.2.1 Thu Sep 28 12:03:49 2006 +++ ZendEngine2/tests/int_overflow_64bit.phpt Mon Dec 24 18:09:50 2007 @@ -6,11 +6,13 @@ <?php $doubles = array( - 9223372036854775808, - 9223372036854775809, - 9223372036854775818, - 9223372036854775908, - 9223372036854776808, + PHP_INT_MAX, + PHP_INT_MAX + 1, + PHP_INT_MAX + 1000, + PHP_INT_MAX * 2 + 4, + -PHP_INT_MAX -1, + -PHP_INT_MAX -2, + -PHP_INT_MAX -1000, ); foreach ($doubles as $d) { @@ -21,8 +23,10 @@ echo "Done\n"; ?> --EXPECTF-- -int(-9223372036854775808) -int(-9223372036854775808) +int(9223372036854775807) +int(9223372036854775807) +int(9223372036854775807) +int(9223372036854775807) int(-9223372036854775808) int(-9223372036854775808) int(-9223372036854775808) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.6&r2=1.445.2.14.2.69.2.7&diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.6 php-src/ext/standard/string.c:1.445.2.14.2.69.2.7 --- php-src/ext/standard/string.c:1.445.2.14.2.69.2.6 Thu Dec 13 22:29:48 2007 +++ php-src/ext/standard/string.c Mon Dec 24 18:09:50 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.445.2.14.2.69.2.6 2007/12/13 22:29:48 tony2001 Exp $ */ +/* $Id: string.c,v 1.445.2.14.2.69.2.7 2007/12/24 18:09:50 dmitry Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2182,12 +2182,12 @@ char *result; char *end = "\r\n"; int endlen = 2; - int chunklen = 76; + long chunklen = 76; int result_len; int argc = ZEND_NUM_ARGS(); - if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &p_str, &p_chunklen, &p_ending) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|ZZ", &p_str, &p_chunklen, &p_ending) == FAILURE) { + return; } convert_to_string_ex(p_str); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_error.phpt?r1=1.2.2.2&r2=1.2.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_error.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_error.phpt:1.2.2.2 php-src/ext/standard/tests/strings/chunk_split_error.phpt:1.2.2.3 --- php-src/ext/standard/tests/strings/chunk_split_error.phpt:1.2.2.2 Sat Sep 29 16:49:41 2007 +++ php-src/ext/standard/tests/strings/chunk_split_error.phpt Mon Dec 24 18:09:50 2007 @@ -32,9 +32,9 @@ --EXPECTF-- *** Testing chunk_split() : error conditions *** -- Testing chunk_split() function with Zero arguments -- -Warning: Wrong parameter count for chunk_split() in %s on line %d +Warning: chunk_split() expects at least 1 parameter, 0 given in %s on line %d NULL -- Testing chunk_split() function with more than expected no. of arguments -- -Warning: Wrong parameter count for chunk_split() in %s on line %d +Warning: chunk_split() expects at most 3 parameters, 4 given in %s on line %d NULL Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation5.phpt?r1=1.2.2.2&r2=1.2.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation5.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation8.phpt?r1=1.2.2.2&r2=1.2.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation8.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_variation8.phpt:1.2.2.2 php-src/ext/standard/tests/strings/chunk_split_variation8.phpt:1.2.2.3 --- php-src/ext/standard/tests/strings/chunk_split_variation8.phpt:1.2.2.2 Sat Sep 29 16:49:40 2007 +++ php-src/ext/standard/tests/strings/chunk_split_variation8.phpt Mon Dec 24 18:09:50 2007 @@ -32,9 +32,9 @@ -123, //negative integer 0234, //octal number 0x1A, //hexadecimal number - 2147483647, //max positive integer number - 2147483648, //max positive integer+1 - -2147483648, //min negative integer + PHP_INT_MAX, //max positive integer number + PHP_INT_MAX * 3, // Will overflow 32 bits on 32 bt system and 64 bits on 64 bit system + -PHP_INT_MAX -1, //min negative integer ); @@ -78,9 +78,10 @@ It has [EMAIL PROTECTED] [EMAIL PROTECTED] 2222 !!!Now \k as escape char to test chunk_split():::" -- Iteration 7 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) +string(129) "This's heredoc string with and + white space char. +It has [EMAIL PROTECTED] [EMAIL PROTECTED] 2222 !!!Now \k as escape char to test +chunk_split():::" -- Iteration 8 -- Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt?r1=1.2.2.3&r2=1.2.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt diff -u php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt:1.2.2.3 php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt:1.2.2.4 --- php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt:1.2.2.3 Mon Dec 17 10:02:13 2007 +++ php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt Mon Dec 24 18:09:50 2007 @@ -37,7 +37,7 @@ // float data 10.5, -10.5, - 10.5e10, + 10.5e20, 10.6E-10, .5,
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php