summaryrefslogtreecommitdiff
path: root/regcomp.h
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2016-03-06 13:56:44 +0100
committerYves Orton <demerphq@gmail.com>2016-03-06 14:06:08 +0100
commitba6840fbf2fdde3e7f1bda1a26f46c901f36d5ec (patch)
treeb13ed1fefd5dc5bdf2c79711f41cbb320bced2dd /regcomp.h
parentd5a00e4af6b155495be31a35728b8fef8e671ebe (diff)
downloadperl-ba6840fbf2fdde3e7f1bda1a26f46c901f36d5ec.tar.gz
fix Perl #126182, out of memory due to infinite pattern recursion
The way we tracked if pattern recursion was infinite did not work properly. A pattern like "a"=~/(.(?2))((?<=(?=(?1)).))/ would loop forever, slowly eat up all available ram as it added pattern recursion stack frames. This patch changes the rules for recursion so that recursively entering a given pattern "subroutine" twice from the same position fails the match. This means that where previously we might have seen fatal exception we will now simply fail. This means that "aaabbb"=~/a(?R)?b/ succeeds with $& equal to "aaabbb".
Diffstat (limited to 'regcomp.h')
-rw-r--r--regcomp.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/regcomp.h b/regcomp.h
index f16197f891..c2e44aab46 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -90,8 +90,6 @@
/* This is the stuff that used to live in regexp.h that was truly
private to the engine itself. It now lives here. */
-
-
typedef struct regexp_internal {
int name_list_idx; /* Optional data index of an array of paren names */
union {