This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Some code paths didn't terminate an inversion list iteration
authorKarl Williamson <khw@cpan.org>
Mon, 26 Aug 2019 00:13:07 +0000 (18:13 -0600)
committerKarl Williamson <khw@cpan.org>
Mon, 26 Aug 2019 15:54:22 +0000 (09:54 -0600)
There were a couple paths through the code that failed to call
invlist_iterfinish().  This was a bug everywhere, but prevented z/OS
from completely compiling.

regcomp.c

index b2cc667..2eba109 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -18890,7 +18890,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
 
                     full_cp_count += this_end - this_start + 1;
                 }
-                invlist_iterfinish(cp_list);
 
                 /* At the end of the loop, we count how many bits differ from
                  * the bits in lowest code point, call the count 'd'.  If the
@@ -18919,8 +18918,10 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
                     ret = reganode(pRExC_state, op, lowest_cp);
                     FLAGS(REGNODE_p(ret)) = ANYOFM_mask;
                 }
+
+              done_anyofm:
+                invlist_iterfinish(cp_list);
             }
-          done_anyofm:
 
             if (inverted) {
                 _invlist_invert(cp_list);