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

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