summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-07-21 09:58:21 -0600
committerKarl Williamson <khw@cpan.org>2016-07-21 10:04:03 -0600
commit33bc5d3d6ec3a139b32d094c90b2f78d7a3a2399 (patch)
tree56b6ceb40b2b31eb7f57e09f41d2737b0ff227a9 /regcomp.c
parent1e0a64115c2048e2aa95c55b284bec003e28b695 (diff)
downloadperl-33bc5d3d6ec3a139b32d094c90b2f78d7a3a2399.tar.gz
PATCH: [perl 128686] regex compiler crashes
This was due to freeing a scalar before its final use
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/regcomp.c b/regcomp.c
index 7f6d5ee8a7..bba5a2be23 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -17475,22 +17475,15 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
&nonascii_but_latin1_properties);
/* And add them to the final list of such characters. */
- if (has_upper_latin1_only_utf8_matches) {
- _invlist_union(has_upper_latin1_only_utf8_matches,
- nonascii_but_latin1_properties,
- &has_upper_latin1_only_utf8_matches);
- SvREFCNT_dec_NN(nonascii_but_latin1_properties);
- }
- else {
- has_upper_latin1_only_utf8_matches
- = nonascii_but_latin1_properties;
- }
+ _invlist_union(has_upper_latin1_only_utf8_matches,
+ nonascii_but_latin1_properties,
+ &has_upper_latin1_only_utf8_matches);
/* Remove them from what now becomes the unconditional list */
_invlist_subtract(posixes, nonascii_but_latin1_properties,
&posixes);
- /* And the remainder are the unconditional ones */
+ /* And add those unconditional ones to the final list */
if (cp_list) {
_invlist_union(cp_list, posixes, &cp_list);
SvREFCNT_dec_NN(posixes);
@@ -17500,8 +17493,11 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
cp_list = posixes;
}
+ SvREFCNT_dec(nonascii_but_latin1_properties);
+
/* Get rid of any characters that we now know are matched
- * unconditionally from the conditional list */
+ * unconditionally from the conditional list, which may make
+ * that list empty */
_invlist_subtract(has_upper_latin1_only_utf8_matches,
cp_list,
&has_upper_latin1_only_utf8_matches);