summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-02-16 09:50:33 -0700
committerKarl Williamson <khw@cpan.org>2019-02-16 10:08:23 -0700
commit75451d8cc625c69a543f2bacf2312d369f8855ae (patch)
treef7815057cfa84cf832562b55c399286ace1c88ff
parentd547f0460acfc3402149384c6eff4f32c8370088 (diff)
downloadperl-75451d8cc625c69a543f2bacf2312d369f8855ae.tar.gz
PATCH: [perl #133767] Assertion failure
The problem here is that a syntax error occurs and hence certain things don't get done, but processing continues, as the error isn't checked for until after the return of the function that found it. The failing assertion is checking that those certain things actually did get done. There appear to be good reasons to defer the raising of the error until then, so the simplest way to fix this is to generalize the code so that the failing assertion doesn't happen.
-rw-r--r--pod/perldelta.pod5
-rw-r--r--regcomp.c9
-rw-r--r--t/re/reg_mesg.t1
3 files changed, 13 insertions, 2 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 74c9bdf799..75bf63e370 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -382,6 +382,11 @@ the same property as another simultaneously. These have now been fixed.
=back
+=item * Assertion failure in compiling invalid regex pattern [perl #133767]
+
+This bug was introduced in the 5.29 series, so this should not be in the
+perldelta for 5.30.
+
=back
=head1 Acknowledgements
diff --git a/regcomp.c b/regcomp.c
index 088b1df7cd..387126e94f 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -18178,8 +18178,13 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
* the only element in the character class (perluniprops.pod notes
* such properties). */
if (partial_cp_count == 0) {
- assert (! invert);
- ret = reganode(pRExC_state, OPFAIL, 0);
+ if (invert) {
+ ret = reg_node(pRExC_state, SANY);
+ }
+ else {
+ ret = reganode(pRExC_state, OPFAIL, 0);
+ }
+
goto not_anyof;
}
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index 13a37b534b..5d88fe745f 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -313,6 +313,7 @@ my @death =
'/(?<=/' => 'Sequence (?... not terminated {#} m/(?<={#}/', # [perl #128170]
'/\p{vertical tab}/' => 'Can\'t find Unicode property definition "vertical tab" {#} m/\\p{vertical tab}{#}/', # [perl #132055]
"/$bug133423/" => "Operand with no preceding operator {#} m/(?[(?^:(?[\\
+ '/[^/' => 'Unmatched [ {#} m/[{#}^/', # [perl #133767]
);