bjori Tue Oct 31 23:57:30 2006 UTC
Modified files:
/php-src/ext/spl spl_iterators.c
Log:
Fix segfault on invalid regex
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.150&r2=1.151&diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.150
php-src/ext/spl/spl_iterators.c:1.151
--- php-src/ext/spl/spl_iterators.c:1.150 Tue Sep 19 07:39:07 2006
+++ php-src/ext/spl/spl_iterators.c Tue Oct 31 23:57:29 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.150 2006/09/19 07:39:07 dmitry Exp $ */
+/* $Id: spl_iterators.c,v 1.151 2006/10/31 23:57:29 bjori Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1021,8 +1021,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