[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] cvs: php-src /ext/wddx wddx.c  /ext/wddx/tests bug35410.phpt
From:       "Ilia Alshanetsky" <iliaa () php ! net>
Date:       2005-11-30 18:13:17
Message-ID: cvsiliaa1133374397 () cvsserver
[Download RAW message or body]

iliaa		Wed Nov 30 13:13:17 2005 EDT

  Modified files:              
    /php-src/ext/wddx/tests	bug35410.phpt 
    /php-src/ext/wddx	wddx.c 
  Log:
  MFB51: Fixed bug #35410 (wddx_deserialize() doesn't handle large ints as keys 
  properly).
  
  
http://cvs.php.net/diff.php/php-src/ext/wddx/tests/bug35410.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/wddx/tests/bug35410.phpt
diff -u /dev/null php-src/ext/wddx/tests/bug35410.phpt:1.2
--- /dev/null	Wed Nov 30 13:13:17 2005
+++ php-src/ext/wddx/tests/bug35410.phpt	Wed Nov 30 13:13:16 2005
@@ -0,0 +1,71 @@
+--TEST--
+#35410 (wddx_deserialize() doesn't handle large ints as keys properly)
+--FILE--
+<?php
+$wddx = <<<WDX
+<wddxpacket version="1.0">
+<header>
+<comment>Content Configuration File</comment>
+</header>
+<data>
+<struct>
+<var name="content_queries">
+<struct>
+<var name="content_113300831086270200">
+<struct>
+<var name="113301888545229100">
+<struct>
+<var name="max">
+<number>10</number>
+</var>
+<var name="cache">
+<number>4</number>
+</var>
+<var name="order">
+<struct>
+<var name="content_113300831086270200">
+<struct>
+<var name="CMS_BUILD">
+<string>desc</string>
+</var>
+</struct>
+</var>
+</struct>
+</var>
+</struct>
+</var>
+</struct>
+</var>
+</struct>
+</var>
+</struct>
+</data>
+</wddxpacket>
+WDX;
+
+var_dump(wddx_deserialize($wddx));
+?>
+--EXPECT--
+array(1) {
+  ["content_queries"]=>
+  array(1) {
+    ["content_113300831086270200"]=>
+    array(1) {
+      ["113301888545229100"]=>
+      array(3) {
+        ["max"]=>
+        int(10)
+        ["cache"]=>
+        int(4)
+        ["order"]=>
+        array(1) {
+          ["content_113300831086270200"]=>
+          array(1) {
+            ["CMS_BUILD"]=>
+            string(4) "desc"
+          }
+        }
+      }
+    }
+  }
+}
http://cvs.php.net/diff.php/php-src/ext/wddx/wddx.c?r1=1.125&r2=1.126&ty=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.125 php-src/ext/wddx/wddx.c:1.126
--- php-src/ext/wddx/wddx.c:1.125	Thu Oct  6 14:47:46 2005
+++ php-src/ext/wddx/wddx.c	Wed Nov 30 13:13:17 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: wddx.c,v 1.125 2005/10/06 18:47:46 rrichards Exp $ */
+/* $Id: wddx.c,v 1.126 2005/11/30 18:13:17 iliaa Exp $ */
 
 #include "php.h"
 
@@ -1006,11 +1006,15 @@
 				
 						switch (is_numeric_string(ent1->varname, strlen(ent1->varname), &l, &d, 0)) {
 							case IS_DOUBLE:
+								if (d > INT_MAX) {
+									goto bigint;
+								}
 								l = (long) d;
 							case IS_LONG:
 								zend_hash_index_update(target_hash, l, &ent1->data, sizeof(zval *), NULL);
 								break;
 							default:
+bigint:
 								zend_hash_update(target_hash,ent1->varname, strlen(ent1->varname)+1, \
&ent1->data, sizeof(zval *), NULL);  }
 					}

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic