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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
From:
Felipe Gasper
Date:
April 1, 2021 11:15
Subject:
Re: Perl 7: Fix string leaks?
Message ID:
F6F94473-71C2-4330-BA7C-3E1A0D9E3218@felipegasper.com

> On Mar 31, 2021, at 21:25, Ben Bullock <benkasminbullock@gmail.com> wrote:
> 
> On Wed, 31 Mar 2021 at 21:40, Felipe Gasper <felipe@felipegasper.com> 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.)

-F

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