summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-08-23 21:39:04 -0600
committerKarl Williamson <khw@cpan.org>2015-08-24 10:49:17 -0600
commite7cce976d7dd1f4fda1f387d02c6403f43346e9c (patch)
tree965ff27c31e9270f5d92fe7214af6ca1cc33b29f
parent354f3e4ea74293dacec2ca84d3762435e9c45701 (diff)
downloadperl-e7cce976d7dd1f4fda1f387d02c6403f43346e9c.tar.gz
PATCH: [perl #125805] Perl segfaults with a regex_sets error message
This fix required an extra test of the return value of a function.
-rw-r--r--pod/perldelta.pod2
-rw-r--r--regcomp.c1
-rw-r--r--t/re/reg_mesg.t1
3 files changed, 3 insertions, 1 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index fe6c8e2e5b..395af69091 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -338,7 +338,7 @@ files in F<ext/> and F<lib/> are best summarized in L</Modules and Pragmata>.
=item *
-XXX
+C<(?[ () ])> no longer segfaults. [perl #125805]
=back
diff --git a/regcomp.c b/regcomp.c
index 4719d12c75..4264274c4a 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -13925,6 +13925,7 @@ redo_curchar:
if (av_tindex(stack) < 0 /* Was empty */
|| ((final = av_pop(stack)) == NULL)
|| ! IS_OPERAND(final)
+ || SvTYPE(final) != SVt_INVLIST
|| av_tindex(stack) >= 0) /* More left on stack */
{
SvREFCNT_dec(final);
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index 452d982d17..a0588241f3 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -219,6 +219,7 @@ my @death =
'/(?[ \x{} ])/' => 'Number with no digits {#} m/(?[ \x{}{#} ])/',
'/(?[ \cK + ) ])/' => 'Unexpected \')\' {#} m/(?[ \cK + ){#} ])/',
'/(?[ \cK + ])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[ \cK + {#}])/',
+ '/(?[ ( ) ])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[ ( ) {#}])/',
'/(?[ \p{foo} ])/' => 'Property \'foo\' is unknown {#} m/(?[ \p{foo}{#} ])/',
'/(?[ \p{ foo = bar } ])/' => 'Property \'foo = bar\' is unknown {#} m/(?[ \p{ foo = bar }{#} ])/',
'/(?[ \8 ])/' => 'Unrecognized escape \8 in character class {#} m/(?[ \8{#} ])/',