|
|
34484a |
From 8121278aa8fe72e9e8aca8651c7f1d4fa204ac1d Mon Sep 17 00:00:00 2001
|
|
|
34484a |
From: Karl Williamson <khw@cpan.org>
|
|
|
34484a |
Date: Mon, 2 Apr 2018 21:54:59 -0600
|
|
|
34484a |
Subject: [PATCH] PATCH: [perl #132167] Parse error in regex_sets
|
|
|
34484a |
MIME-Version: 1.0
|
|
|
34484a |
Content-Type: text/plain; charset=UTF-8
|
|
|
34484a |
Content-Transfer-Encoding: 8bit
|
|
|
34484a |
|
|
|
34484a |
When popping the stack, the code inappropriately also subtracted one
|
|
|
34484a |
from the result. This is probably left over from an earlier change in
|
|
|
34484a |
the implementation. The top of the stack contained the correct value;
|
|
|
34484a |
subtracting was a mistake.
|
|
|
34484a |
|
|
|
34484a |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
34484a |
---
|
|
|
34484a |
regcomp.c | 2 +-
|
|
|
34484a |
t/re/regex_sets.t | 11 +++++++++++
|
|
|
34484a |
2 files changed, 12 insertions(+), 1 deletion(-)
|
|
|
34484a |
|
|
|
34484a |
diff --git a/regcomp.c b/regcomp.c
|
|
|
34484a |
index 018d5646fc..39ab260efa 100644
|
|
|
34484a |
--- a/regcomp.c
|
|
|
34484a |
+++ b/regcomp.c
|
|
|
34484a |
@@ -15689,7 +15689,7 @@ redo_curchar:
|
|
|
34484a |
* fence. Get rid of it */
|
|
|
34484a |
fence_ptr = av_pop(fence_stack);
|
|
|
34484a |
assert(fence_ptr);
|
|
|
34484a |
- fence = SvIV(fence_ptr) - 1;
|
|
|
34484a |
+ fence = SvIV(fence_ptr);
|
|
|
34484a |
SvREFCNT_dec_NN(fence_ptr);
|
|
|
34484a |
fence_ptr = NULL;
|
|
|
34484a |
|
|
|
34484a |
diff --git a/t/re/regex_sets.t b/t/re/regex_sets.t
|
|
|
34484a |
index e9644bd4e6..e70df81254 100644
|
|
|
34484a |
--- a/t/re/regex_sets.t
|
|
|
34484a |
+++ b/t/re/regex_sets.t
|
|
|
34484a |
@@ -204,6 +204,17 @@ for my $char ("٠", "٥", "٩") {
|
|
|
34484a |
like("a", qr/$pat/, "/$pat/ compiles and matches 'a'");
|
|
|
34484a |
}
|
|
|
34484a |
|
|
|
34484a |
+{ # [perl #132167]
|
|
|
34484a |
+ fresh_perl_is('no warnings "experimental::regex_sets";
|
|
|
34484a |
+ print "c" =~ qr/(?[ ( \p{Uppercase} ) + (\p{Lowercase} - ([a] + [b])) ])/;',
|
|
|
34484a |
+ 1, {},
|
|
|
34484a |
+ 'qr/(?[ ( \p{Uppercase} ) + (\p{Lowercase} - ([a] + [b])) ]) compiles and properly matches');
|
|
|
34484a |
+ fresh_perl_is('no warnings "experimental::regex_sets";
|
|
|
34484a |
+ print "b" =~ qr/(?[ ( \p{Uppercase} ) + (\p{Lowercase} - ([a] + [b])) ])/;',
|
|
|
34484a |
+ "", {},
|
|
|
34484a |
+ 'qr/(?[ ( \p{Uppercase} ) + (\p{Lowercase} - ([a] + [b])) ]) compiles and properly matches');
|
|
|
34484a |
+}
|
|
|
34484a |
+
|
|
|
34484a |
done_testing();
|
|
|
34484a |
|
|
|
34484a |
1;
|
|
|
34484a |
--
|
|
|
34484a |
2.14.3
|
|
|
34484a |
|