In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/90973738b247b0573fa8c1cbcfbcd3ee60a1baee?hp=a57a2641016045bced6ece77dfb390e92112b375>
- Log ----------------------------------------------------------------- commit 90973738b247b0573fa8c1cbcfbcd3ee60a1baee Author: Karl Williamson <k...@cpan.org> Date: Thu Dec 27 19:35:01 2018 -0700 regcomp.c: White-space only Indent the block added by the previous commit commit 5aa750d1acfc388f19dcaaa3ad8d88fd169c82b5 Author: Karl Williamson <k...@cpan.org> Date: Thu Dec 27 19:31:18 2018 -0700 regcomp.c: Avoid reading out-of-bounds memory Recent commit c316b824875fdd5ce52338f301fb0255d843dfec introduced an out-of-bounds memory read. This commit fixes it. An ANYOFH regnode doesn't have a bitmap, so don't try to read it. ----------------------------------------------------------------------- Summary of changes: regcomp.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/regcomp.c b/regcomp.c index 0de0afd9be..034033b44c 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1617,15 +1617,19 @@ S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, } /* Add in the points from the bit map */ - for (i = 0; i < NUM_ANYOF_CODE_POINTS; i++) { - if (ANYOF_BITMAP_TEST(node, i)) { - unsigned int start = i++; + if (OP(node) != ANYOFH) { + for (i = 0; i < NUM_ANYOF_CODE_POINTS; i++) { + if (ANYOF_BITMAP_TEST(node, i)) { + unsigned int start = i++; - for (; i < NUM_ANYOF_CODE_POINTS && ANYOF_BITMAP_TEST(node, i); ++i) { - /* empty */ + for (; i < NUM_ANYOF_CODE_POINTS + && ANYOF_BITMAP_TEST(node, i); ++i) + { + /* empty */ + } + invlist = _add_range_to_invlist(invlist, start, i-1); + new_node_has_latin1 = TRUE; } - invlist = _add_range_to_invlist(invlist, start, i-1); - new_node_has_latin1 = TRUE; } } -- Perl5 Master Repository