felipe          Mon Sep 22 13:06:29 2008 UTC

  Added files:                 
    /php-src/ext/spl/tests      bug46088.phpt 

  Modified files:              
    /php-src/ext/spl    spl_iterators.c 
  Log:
  - Fixed bug #46088 (RegexIterator::accept - segfault)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.178&r2=1.179&diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.178 
php-src/ext/spl/spl_iterators.c:1.179
--- php-src/ext/spl/spl_iterators.c:1.178       Tue Sep  9 19:43:52 2008
+++ php-src/ext/spl/spl_iterators.c     Mon Sep 22 13:06:28 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.178 2008/09/09 19:43:52 lbarnaud Exp $ */
+/* $Id: spl_iterators.c,v 1.179 2008/09/22 13:06:28 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1746,6 +1746,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 = snprintf(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