bjori           Fri Nov  3 14:11:23 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/spl    spl_iterators.c 
  Log:
  MFH: fix crash on invalid regex
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.17&r2=1.73.2.30.2.18&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.17 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.18
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.17      Fri Jul 21 21:26:11 2006
+++ php-src/ext/spl/spl_iterators.c     Fri Nov  3 14:11:23 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.17 2006/07/21 21:26:11 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.18 2006/11/03 14:11:23 bjori Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1012,8 +1012,13 @@
                        intern->u.regex.mode = mode;
                        intern->u.regex.regex = estrndup(regex, regex_len);
                        intern->u.regex.pce = 
pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC);
+                       if (intern->u.regex.pce == NULL) {
+                               /* pcre_get_compiled_regex_cache has already 
sent error */
+                               php_set_error_handling(EH_NORMAL, NULL 
TSRMLS_CC);
+                               return NULL;
+                       }
                        intern->u.regex.pce->refcount++;
-                       break;;
+                       break;
                }
 #endif
                default:

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

Reply via email to