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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
Felipe Gasper
April 1, 2021 11:15
Re: Perl 7: Fix string leaks?
Message ID:

> On Mar 31, 2021, at 21:25, Ben Bullock <> wrote:
> On Wed, 31 Mar 2021 at 21:40, Felipe Gasper <> wrote:
>>> Anyway, if you want a more conservative approach you can also make
>>> a version of SvPV (say SvPV_bad) that warns on first use and
>>> change the default typemaps to use it.
>> I would love to take an approach like this, but I think it would
>> create too many warnings in code that currently “happens” to work
>> consistently.
>> I *do* think that SvPV should be renamed to SvPVinternal, or some such.
> Your justification would be avoiding errors around Unicode bytes?
> Changing the typemap would undoubtedly break things, but disabling
> SvPV will break probably more than half the XS modules on CPAN,
> including ones which use SV* to store binary data such as PNG images
> or encrypted data, where the issue about upgrading and downgrading
> Unicode bytes is irrelevant. The same goes for adding warnings and so
> on.

Also, this isn’t quite true. It’s entirely possible for Perl or some XS module to upgrade a string that contains a PNG. If Perl could distinguish binary from text we could prevent that. (See my proposal earlier in this thread.)


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