In perl.git, the branch maint-5.28 has been updated <https://perl5.git.perl.org/perl.git/commitdiff/1ad6540c1f5815915eea5dab3c225d35f4632868?hp=c12901e13e2df1d8ea437a99f39fdcb9209f2edf>
- Log ----------------------------------------------------------------- commit 1ad6540c1f5815915eea5dab3c225d35f4632868 Author: Karl Williamson <[email protected]> Date: Thu Mar 7 13:44:34 2019 -0700 PATCH: [perl #133882] Assertion failure The asserts in this routine were doing there job. It was called inappropriately, with len set to 0, which means for it that it's supposed to calculate the length by using strlen(). But, len being 0 here meant that the input was empty. When run under valgrind, errors would also show up. This function was being called to see if the string had any characters that varied depending on if it is UTF-8 or not. Since we know that the answer is no if the length is 0, we simply don't call this function then. (cherry picked from commit 534636494a1e2160ed87b0b7531ddb162be85b6e) ----------------------------------------------------------------------- Summary of changes: t/re/subst.t | 7 ++++--- toke.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/t/re/subst.t b/t/re/subst.t index dd62e95ee6..d0fb048674 100644 --- a/t/re/subst.t +++ b/t/re/subst.t @@ -11,7 +11,7 @@ BEGIN { require './loc_tools.pl'; } -plan(tests => 276); +plan(tests => 277); $_ = 'david'; $a = s/david/rules/r; @@ -1174,5 +1174,6 @@ __EOF__ is $lines, 4, "RT #131930"; } - - +{ + fresh_perl_is("s//00000000000format \0 '0000000\\x{800}/;eval", "", {}, "RT #133882"); +} diff --git a/toke.c b/toke.c index fc87252bb1..ee6c698ec6 100644 --- a/toke.c +++ b/toke.c @@ -2068,6 +2068,7 @@ S_newSV_maybe_utf8(pTHX_ const char *const start, STRLEN len) SV * const sv = newSVpvn_utf8(start, len, ! IN_BYTES && UTF + && len != 0 && is_utf8_non_invariant_string((const U8*)start, len)); return sv; } -- Perl5 Master Repository
