felipe          Mon Sep 22 13:15:16 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/spl/tests      bug46088.phpt 

  Modified files:              
    /php-src/ext/spl    spl_iterators.c 
  Log:
  - MFH: Fixed bug #46088 (RegexIterator::accept - segfault)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.32&r2=1.73.2.30.2.33&diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.32 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.33
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.32      Tue Sep  9 19:44:25 2008
+++ php-src/ext/spl/spl_iterators.c     Mon Sep 22 13:15:16 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.32 2008/09/09 19:44:25 lbarnaud Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.33 2008/09/22 13:15:16 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1363,6 +1363,10 @@
        int        subject_len, use_copy, count, result_len;
        zval       subject_copy, zcount, *replacement;
 
+       if (intern->current.data == NULL) {
+               RETURN_FALSE;
+       }
+
        if (intern->u.regex.flags & REGIT_USE_KEY) {
                if (intern->current.key_type == HASH_KEY_IS_LONG) {
                        subject_len = slprintf(tmp, sizeof(tmp), "%ld", 
intern->current.int_key);

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug46088.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug46088.phpt
+++ php-src/ext/spl/tests/bug46088.phpt
--TEST--
Bug #46088 (RegexIterator::accept - segfault)
--FILE--
<?php

$x = new RegexIterator(new ArrayIterator(range(1, 10)), '/\d/');
var_dump($x->accept());

?>
--EXPECT--
bool(false)



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

Reply via email to