Blame SOURCES/perl-5.24.3-perl-132227-restart-a-node-if-we-change-to-uni-rules.patch

2c161b
From e02d7478ebfc399a9d10ba0df60eee217aa7ab8f Mon Sep 17 00:00:00 2001
2c161b
From: Karl Williamson <khw@cpan.org>
2c161b
Date: Fri, 2 Feb 2018 15:14:27 -0700
2c161b
Subject: (perl #132227) restart a node if we change to uni rules within the
2c161b
 node and encounter a sharp S
2c161b
2c161b
This could lead to a buffer overflow.
2c161b
---
2c161b
 regcomp.c | 12 ++++++++++++
2c161b
 1 file changed, 12 insertions(+)
2c161b
2c161b
diff --git a/regcomp.c b/regcomp.c
2c161b
index c6c7cb4925..d79bd191c9 100644
2c161b
--- a/regcomp.c
2c161b
+++ b/regcomp.c
2c161b
@@ -13323,6 +13323,18 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
2c161b
                          * /u.  This includes the multi-char fold SHARP S to
2c161b
                          * 'ss' */
2c161b
                         if (UNLIKELY(ender == LATIN_SMALL_LETTER_SHARP_S)) {
2c161b
+
2c161b
+                            /* If the node started out having uni rules, we
2c161b
+                             * wouldn't have gotten here.  So this means
2c161b
+                             * something in the middle has changed it, but
2c161b
+                             * didn't think it needed to reparse.  But this
2c161b
+                             * sharp s now does indicate the need for
2c161b
+                             * reparsing. */
2c161b
+                            if (RExC_uni_semantics) {
2c161b
+                                p = oldp;
2c161b
+                                goto loopdone;
2c161b
+                            }
2c161b
+
2c161b
                             RExC_seen_unfolded_sharp_s = 1;
2c161b
                             maybe_exactfu = FALSE;
2c161b
                         }
2c161b
-- 
2c161b
2.11.0
2c161b