This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #129125) copy form data if it might be freed
authorTony Cook <tony@develop-help.com>
Thu, 19 Jan 2017 05:28:03 +0000 (16:28 +1100)
committerTony Cook <tony@develop-help.com>
Thu, 19 Jan 2017 05:28:03 +0000 (16:28 +1100)
commit86191aed6f092273950ebdd48f886d4ec0c5e85e
tree1a8b89b1031fd63e9fc70abc0e589365a6c38e75
parent564894eac8e9ca301638cfa07ae8791b6132f146
(perl #129125) copy form data if it might be freed

If the format SV also appeared as an argument, and the FF_CHOP
operator modified that argument, the magic and hence the compiled
format would be freed, and the next iteration of the processing
the compiled format would read freed memory.

Unlike my original patch this copies the formsv too, since
that is also stored in the magic, and is needed for presenting
literal text from the format.
pp_ctl.c
t/op/write.t