Branch: refs/heads/davem/clone
  Home:   https://github.com/Perl/perl5
  Commit: cd546bd54a2be65514cec6198352fafda0cb0787
      
https://github.com/Perl/perl5/commit/cd546bd54a2be65514cec6198352fafda0cb0787
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-02-12 (Mon, 12 Feb 2024)

  Changed paths:
    M ext/XS-APItest/APItest.xs

  Log Message:
  -----------
  avoid ext/XS-APItest/t/clone-with-stack.t crash

a fresh_perl() TODO test in this file does something like

    use XS::APItest;
    BEGIN {
        clone_with_stack();
    }
    print "ok\n";

As a standalone program, this code gives errors under valgrind,
and in ticket GH #21969 was causing "perl.exe has stopped working" on
Windows 8.

The clone_with_stack() XS function is fairly dodgy - it clones the whole
interpreter including stacks (i.e. what fork() emulation on windows
does), but then continues the RUNOPS loop to completion itself, using
the cloned interpreter, rather than relying on the caller to finish the
ops loop.

This doesn't work very well under BEGIN (hence why it's a TODO test),
but specifically, PL_curcop can be left pointing at an op which gets
freed , but then is later accessed anyway.

This commit resets PL_curcop to &PL_compiling to avoid crashes.


Reply via email to