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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
Dan Book
March 29, 2021 00:24
Re: Perl 7: Fix string leaks?
Message ID:
On Sat, Mar 27, 2021 at 7:48 AM Felipe Gasper <>

> 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.

I would love if this was possible as the current behavior is certainly
broken. However, it's also relied upon, and as you know, difficult to
determine whether it's being relied upon incorrectly. So I cannot support
this breakage, major version or not.

I can only see this being feasible via a feature flag, for the moment.


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