rasmus          Tue Apr  1 16:44:47 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4       TODO_SEGFAULTS 
    /php4/ext/standard  array.c 
  Log:
  Arbitrarily limit array_pad() to only do 1 million elements at a time.
  Probably still too high, but it solves the segfault for now.
  
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.7 php4/TODO_SEGFAULTS:1.1.2.8
--- php4/TODO_SEGFAULTS:1.1.2.7 Tue Apr  1 14:10:35 2003
+++ php4/TODO_SEGFAULTS Tue Apr  1 16:44:47 2003
@@ -8,11 +8,10 @@
     socket_iovec_alloc (Rasmus)
        exif_imagetype,exif_thumbnail (Rasmus)
     dbase_open (Rasmus)
-
+       array_pad (Rasmus)
 
 Open:
 
-    array_pad
     bcsub (1)
     mb_ereg (2)
     mb_ereg_match (2)
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.199.2.14 php4/ext/standard/array.c:1.199.2.15
--- php4/ext/standard/array.c:1.199.2.14        Thu Feb  6 10:28:28 2003
+++ php4/ext/standard/array.c   Tue Apr  1 16:44:47 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.199.2.14 2003/02/06 15:28:28 sniper Exp $ */
+/* $Id: array.c,v 1.199.2.15 2003/04/01 21:44:47 rasmus Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -2339,6 +2339,10 @@
        
        /* Populate the pads array */
        num_pads = pad_size_abs - input_size;
+       if(num_pads > 1048576) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 
1048576 elements at a time");
+               RETURN_FALSE;
+       }
        pads = (zval ***)emalloc(num_pads * sizeof(zval **));
        for (i = 0; i < num_pads; i++)
                pads[i] = pad_value;



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

Reply via email to