dmitry          Mon Dec 24 18:10:20 2007 UTC

  Modified files:              
    /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.285&r2=1.286&diff_format=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.285 ZendEngine2/zend_operators.c:1.286
--- ZendEngine2/zend_operators.c:1.285  Mon Dec 17 11:06:42 2007
+++ ZendEngine2/zend_operators.c        Mon Dec 24 18:10:19 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_operators.c,v 1.285 2007/12/17 11:06:42 dmitry Exp $ */
+/* $Id: zend_operators.c,v 1.286 2007/12/24 18:10:19 dmitry Exp $ */
 
 #include <ctype.h>
 
@@ -243,34 +243,35 @@
 #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
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/int_overflow_64bit.phpt?r1=1.2&r2=1.3&diff_format=u
Index: ZendEngine2/tests/int_overflow_64bit.phpt
diff -u ZendEngine2/tests/int_overflow_64bit.phpt:1.2 
ZendEngine2/tests/int_overflow_64bit.phpt:1.3
--- ZendEngine2/tests/int_overflow_64bit.phpt:1.2       Thu Sep 28 12:08:44 2006
+++ ZendEngine2/tests/int_overflow_64bit.phpt   Mon Dec 24 18:10:19 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.657&r2=1.658&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.657 php-src/ext/standard/string.c:1.658
--- php-src/ext/standard/string.c:1.657 Thu Dec 13 22:29:15 2007
+++ php-src/ext/standard/string.c       Mon Dec 24 18:10:19 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.657 2007/12/13 22:29:15 tony2001 Exp $ */
+/* $Id: string.c,v 1.658 2007/12/24 18:10:19 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3339,7 +3339,7 @@
        zstr result;
        char *end    = "\r\n";
        UChar u_end[3] = { 0x0d, 0x0a, 0x0 };
-       int chunklen = 76;
+       long chunklen = 76;
        int result_len;
        zend_uchar str_type;
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_error.phpt?r1=1.2&r2=1.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 
php-src/ext/standard/tests/strings/chunk_split_error.phpt:1.3
--- php-src/ext/standard/tests/strings/chunk_split_error.phpt:1.2       Sat Sep 
29 12:57:06 2007
+++ php-src/ext/standard/tests/strings/chunk_split_error.phpt   Mon Dec 24 
18:10:20 2007
@@ -19,7 +19,7 @@
 echo "-- Testing chunk_split() function with Zero arguments --";
 var_dump( chunk_split() );
 
-//Test chunk_split with one more than the expected number of arguments
+// With one more than the expected number of arguments
 $str = 'Testing chunk_split';
 $chunklen = 5;
 $ending = '***';
@@ -38,12 +38,3 @@
 Warning: chunk_split() expects at most 3 parameters, 4 given in %s on line %d
 NULL
 Done
---UEXPECTF--
-*** Testing chunk_split() : error conditions ***
--- Testing chunk_split() function with Zero arguments --
-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: 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&r2=1.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&r2=1.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 
php-src/ext/standard/tests/strings/chunk_split_variation8.phpt:1.3
--- php-src/ext/standard/tests/strings/chunk_split_variation8.phpt:1.2  Sat Sep 
29 12:57:06 2007
+++ php-src/ext/standard/tests/strings/chunk_split_variation8.phpt      Mon Dec 
24 18:10:20 2007
@@ -1,5 +1,5 @@
 --TEST--
-Test chunk_split() function : usage variations - different integer values for 
'chunklen' with heredoc string as 'str'
+Test chunk_split() function : usage variations - different integer values for 
'chunklen' with heredoc string as 'str'(Bug#42796)
 --FILE--
 <?php
 /* Prototype  : string chunk_split(string $str [, int $chunklen [, string 
$ending]])
@@ -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
 
 );
 
@@ -51,7 +51,7 @@
 *** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
 -- Iteration 1 --
 
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line 
%d%d
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line 
%d
 bool(false)
 -- Iteration 2 --
 string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: 
:::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: :::      ::: :::a:::n:::d::: :::
@@ -60,7 +60,7 @@
 :::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::"
 -- Iteration 3 --
 
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line 
%d%d
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line 
%d
 bool(false)
 -- Iteration 4 --
 string(129) "This's heredoc string with         and 
@@ -78,15 +78,15 @@
 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%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%d
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line 
%d
 bool(false)
 Done
-
 --UEXPECTF--
 *** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
 -- Iteration 1 --
@@ -118,11 +118,13 @@
 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)
+unicode(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
 bool(false)
 Done
+
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt?r1=1.3&r2=1.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.3 
php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt:1.4
--- 
php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt:1.3  
    Mon Dec 17 11:06:42 2007
+++ php-src/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt  
Mon Dec 24 18:10:20 2007
@@ -37,7 +37,7 @@
       // float data
       10.5,
       -10.5,
-      10.5e10,
+      10.5e20,
       10.6E-10,
       .5,
 
@@ -209,27 +209,27 @@
 
 -- Iteration 6 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %s on line %d
 NULL
 
 -- Iteration 7 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %s on line %d
 NULL
 
 -- Iteration 8 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %s on line %d
 NULL
 
 -- Iteration 9 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %s on line %d
 NULL
 
 -- Iteration 10 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given 
in %s on line %d
 NULL
 
 -- Iteration 11 --
@@ -252,27 +252,27 @@
 
 -- Iteration 17 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %s on line %d
 NULL
 
 -- Iteration 18 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %s on line %d
 NULL
 
 -- Iteration 19 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %s on line %d
 NULL
 
 -- Iteration 20 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode 
string given in %s on line %d
 NULL
 
 -- Iteration 21 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, object 
given in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, object 
given in %s on line %d
 NULL
 
 -- Iteration 22 --
@@ -283,7 +283,6 @@
 
 -- Iteration 24 --
 
-Warning: htmlspecialchars_decode() expects parameter 2 to be long, resource 
given in %shtmlspecialchars_decode_variation2.php on line %d
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, resource 
given in %s on line %d
 NULL
 Done
-

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to