summaryrefslogtreecommitdiff
path: root/pcre_compile.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2014-02-09 18:55:03 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2014-02-09 18:55:03 +0000
commit8546a4442ddba4fa7ac6143f8c88ebce46fa3dd2 (patch)
treeac1a23f96b3b5d2671387e4e066486bbb88fa16e /pcre_compile.c
parent4cb4c9cc746011f77bb8d1b6f5a8480b86e4c8ee (diff)
downloadpcre-8546a4442ddba4fa7ac6143f8c88ebce46fa3dd2.tar.gz
Implement pcre_stack_guard.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1454 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r--pcre_compile.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index 99017c4..e220799 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -547,6 +547,8 @@ static const char error_texts[] =
"parentheses are too deeply nested\0"
"invalid range in character class\0"
"group name must start with a non-digit\0"
+ /* 85 */
+ "parentheses are too deeply nested (stack check)\0"
;
/* Table to identify digits and hex digits. This is used when compiling
@@ -8033,6 +8035,16 @@ unsigned int orig_bracount;
unsigned int max_bracount;
branch_chain bc;
+/* If set, call the external function that checks for stack availability. */
+
+if (PUBL(stack_guard) != NULL && PUBL(stack_guard)())
+ {
+ *errorcodeptr= ERR85;
+ return FALSE;
+ }
+
+/* Miscellaneous initialization */
+
bc.outer = bcptr;
bc.current_branch = code;