I Use This!
Activity Not Available

Commits : Individual Commit

Analyzed about 1 month ago. based on code collected 2 months ago.

Commit ID 4a69216a74159df74779841fa79d731bcc5c6a9d

Anon80 Contributor: David Mitchell Files Modified 2
Date: 14-September-2019 at 15:18 Lines Added: 41
Repository: git://perl5.git.perl.org/perl.git blead Lines Removed: 1
Commit Comment: Avoid panic when last s///g is tainted and utf8 RT #134409 In a repeated substitution, where the replacement is an expression, and when the last replacement value is both tainted and utf8, and everything earlier has been plain, and the final string is suitably shorter than the original, a panic resulted: sv_pos_b2u: bad byte offset, blen=1, byte=6 This is because when at the end, taint magic is being being added to the target of the s///, the target SV has already had its buffer updated with the shorter result string, but still has the pos() magic set which corresponded to the original longer string (this pos value would, in the normal flow of things, be reset shortly afterwards). One quirk of sv_magic(), which adds any sort of magic including taint magic, is that it always checks for the presence of pos() magic, and if so, converts the byte to utf8 offset if necessary. This was seeing the invalid pos() offset and panicing. The check was added by v5.19.3-111-g25fdce4a16: "Stop pos() from being confused by changing utf8ness" It seems like a bit of hack to recalibrate pos() each time sv_magic() is called, but I've left that alone (sleeping dogs and all that) and instead added a hack in the taint code path in pp_substcont to reset pos before setting taint.

Changes by Language

Language Code Added Code Removed Comments Added Comments Removed Blanks Added Blanks Removed
  Perl 13 1 5 0 5 0
  C 7 0 9 0 2 0

Changes by File

File Language Code Added Code Removed Comments Added Comments Removed Blanks Added Blanks Removed
pp_ctl.c C 7 0 9 0 2 0
t/op/taint.t Perl 13 1 5 0 5 0