develooper Front page | perl.perl5.porters | Postings from October 2015

Re: [perl #126181] regex: \c inside (?[]) causes panics andunexpected behavior

Thread Next
From:
Victor ADAM
Date:
October 1, 2015 14:28
Subject:
Re: [perl #126181] regex: \c inside (?[]) causes panics andunexpected behavior
Message ID:
CAATTT4UhPHg55tT9ha-GGhdo0eXQ8qz5_cfLjf3_kb-cu6f5KA@mail.gmail.com
Sorry for the mess-up. Here’s the patch again. I’m also including it
in the body of the email, just in case the attachment fails again.

From 96cb469f3930a276be8cedac7d23e9a26899be08 Mon Sep 17 00:00:00 2001
From: Victor Adam <victor@drawall.cc>
Date: Sun, 27 Sep 2015 10:22:08 +0200
Subject: [PATCH] regex: handle \cX inside (?[])

The \cX notation for control characters used to cause panics and unexpected
behavior when used insed an extended character class. See bug #126181.

The solution is to ignore the byte following \c during the first parsing pass
of a (?[]) construct.
---
 AUTHORS   | 1 +
 regcomp.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/AUTHORS b/AUTHORS
index 451c707..ebd9222 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1222,6 +1222,7 @@ Unicode Consortium              <unicode.org>
 Vadim Konovalov			<vkonovalov@lucent.com>
 Valeriy E. Ushakov		<uwe@ptc.spbu.ru>
 Vernon Lyon			<vlyon@cpan.org>
+Victor Adam			<victor@drawall.cc>
 Victor Efimov			<victor@vsespb.ru>
 Viktor Turskyi			<koorchik@gmail.com>
 Ville Skyttä			<scop@cs132170.pp.htv.fi>
diff --git a/regcomp.c b/regcomp.c
index 4f4bb44..a8e80ee 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -13454,6 +13454,10 @@ S_handle_regex_sets(pTHX_ RExC_state_t
*pRExC_state, SV** return_invlist,
                      * default: case next time and keep on incrementing until
                      * we find one of the invariants we do handle. */
                     RExC_parse++;
+                    if (*RExC_parse == 'c') {
+                            /* Skip the \cX notation for control characters */
+                            RExC_parse++;
+                    }
                     break;
                 case '[':
                 {
-- 
2.4.5

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About