Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.9k stars 540 forks source link

pp_pack: SvPV_force() pack(p/P, ...) arguments when writable #22407

Closed tonycoz closed 6 days ago

tonycoz commented 1 month ago

pack("p"/"P") is generally pretty awful, but we document that you can pack("P") and then write to the pointer supplied, so make that safer by ensuring the PV isn't shared with other SVs.

Since _force() throws on a READONLY SV, and you shouldn't be writing to one, only _force() for a writable SV.

This is still broken when magic is involved, but we did document it as usable.

Fixes the UUID::FFI part of #22380

Some other modules (and UUID::FFI itself, really) will need XS fixes.