summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorHannes Magnusson <bjori@php.net>2006-11-03 14:11:23 +0000
committerHannes Magnusson <bjori@php.net>2006-11-03 14:11:23 +0000
commitbece30aee57de12bffffba2fd1d455c39cd4c7f4 (patch)
tree40a052b0ccb92f9ad398867acd865864c0034595 /ext
parent9445a302aefc9ece74542867e4540c54931774c0 (diff)
downloadphp-git-bece30aee57de12bffffba2fd1d455c39cd4c7f4.tar.gz
MFH: fix crash on invalid regex
Diffstat (limited to 'ext')
-rwxr-xr-xext/spl/spl_iterators.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 195c500355..eadb2ed691 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1012,8 +1012,13 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
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: