develooper Front page | perl.perl5.porters | Postings from March 2021

Perl 7: Fix string leaks?

Thread Next
Felipe Gasper
March 27, 2021 11:48
Perl 7: Fix string leaks?
Message ID:
If “gently breaking” changes in Perl 7 are possible, would fixing these conspicuous leaks in Perl’s string storage abstraction be possible?

1) Change the default XS typemap such that `char *` and `const char *` use SvPVbyte_nolen. The status quo here uses SvPV_nolen, which leaks the SV internals without giving the XS code any means to “recover” from the leak (i.e. to query the SV’s UTF8 bit).

2) Change exec, mkdir, et al. to use SvPVbyte_nolen rather than SvPV_nolen. This fixes the same problem. It’s what CPAN Sys::Binmode does currently; this would apply that change to core instead.

Both of these will break code that decodes strings without manually encoding them for output to a byte layer, so they’re not really workable in Perl 5. But they’re also eminent examples of desirable-but-breaking fixes.

I’m happy to work on these when/if it’s decided that they’re agreeable.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About