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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
March 29, 2021 03:52
Subject:
Re: Perl 7: Fix string leaks?
Message ID:
CAExogxN2ULyfse8=d1LtJYacoXqaF3tsJ4wJgkiD5HbVSEnu3Q@mail.gmail.com
Is this problem can be solved with the new Perl and feature flag?

Is needed Perl itself changing?


2021年3月27日(土) 20:48 Felipe Gasper <felipe@felipegasper.com>:

> 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.
>
> cheers,
> -Felipe

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About