Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: f67317ac46bd8d6c0b30bcd4ac7e8201fe83b22d
      
https://github.com/Perl/perl5/commit/f67317ac46bd8d6c0b30bcd4ac7e8201fe83b22d
  Author: Tony Cook <[email protected]>
  Date:   2026-03-03 (Tue, 03 Mar 2026)

  Changed paths:
    M t/class/method.t

  Log Message:
  -----------
  class/method.t: test for crash on refaliased field


  Commit: 6b4504427fa4986eb6d58ced3a027d334f31b7eb
      
https://github.com/Perl/perl5/commit/6b4504427fa4986eb6d58ced3a027d334f31b7eb
  Author: Tony Cook <[email protected]>
  Date:   2026-03-03 (Tue, 03 Mar 2026)

  Changed paths:
    M class.c
    M t/class/method.t

  Log Message:
  -----------
  pp_methstart: ensure we release the right SV on method exit

Prior to this change, pp_methstart would save_freesv() each method pad
entry SV as it populated the method pad with fields, so the field SV
itself would be released when the method finished (or if an exception
was thrown.)

But if the field (really just the method pad entry) was refassigned
to, *that* would release the reference on the field SV, and then the
save stack entry from save_freesv() would also release the SV,
typically resulting the SV being freed, invalidating the SV stored in
the object field.

Later references to that field would then typically crash, or throw an
assertion.

To avoid that use save_clearsv(), which releases whatever is in the
given SV** pointer, not the SV * provided.

This means that the replacement SV from the refassign in the PAD slot
for the field is released on exit from the method, *not* the original
field SV which has already been released.

Using save_clearsv() here mirrors the the use in pp_padsv and other
padsv introduction cases.

https://github.com/Perl/perl5/pull/24187#discussion_r2814795858

Also, fix the indentation of this block.


  Commit: 2a50be84181824367ae7e0a159ae9bddeed500fb
      
https://github.com/Perl/perl5/commit/2a50be84181824367ae7e0a159ae9bddeed500fb
  Author: Tony Cook <[email protected]>
  Date:   2026-03-03 (Tue, 03 Mar 2026)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  perldelta for refassigning to a class field leads to a crash


Compare: https://github.com/Perl/perl5/compare/de3c4f2f659a...2a50be841818

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to