summaryrefslogtreecommitdiff
path: root/regcomp.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-03-17 22:11:04 -0600
committerKarl Williamson <khw@cpan.org>2019-03-17 22:17:29 -0600
commit6ef7fe531911e0b41ffcc04c1d6b6ec25a8b1bc9 (patch)
tree0fc833fa2bf0171a01f395300906e586a316485f /regcomp.h
parent3b89859ad83deaeff7c1ee7911d181ef10236879 (diff)
downloadperl-6ef7fe531911e0b41ffcc04c1d6b6ec25a8b1bc9.tar.gz
PATCH: [perl #131551] Too deep regex compilation recursion
This patch, started by Yves Orton, and refined in consultation with Tony Cook, imposes a maximum depth of unclosed left parentheses, at which point it croaks. This is to prevent the segfault in the ticket. The patch adds a variable that can be set to increase or decrease this limit at run time (actually regex compilation time) should this be desired, and hence our pre-determined limit of 1000 can be changed if necessary.
Diffstat (limited to 'regcomp.h')
-rw-r--r--regcomp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/regcomp.h b/regcomp.h
index 7a4432e3d6..5002e2b38d 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -946,6 +946,9 @@ typedef struct _reg_ac_data reg_ac_data;
#define RE_TRIE_MAXBUF_NAME "\022E_TRIE_MAXBUF"
#define RE_DEBUG_FLAGS "\022E_DEBUG_FLAGS"
+#define RE_COMPILE_RECURSION_INIT 1000
+#define RE_COMPILE_RECURSION_LIMIT "\022E_COMPILE_RECURSION_LIMIT"
+
/*
RE_DEBUG_FLAGS is used to control what debug output is emitted