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 10:56
Subject:
Re: Perl 7: Fix string leaks?
Message ID:
42708733-0AF2-42ED-BDE5-B3482B059893@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.

Sorry, I meant rename to SvPVinternal but leave SvPV as an alias. Then update documentation to use the new name.

> If SvPV or the default typemap for char * are to be avoided by
> programmers, the first step is to document that in perlapi and perlxs
> (the documentation). At the moment such documentation does not
> exist.

See my pull request: https://github.com/Perl/perl5/pull/18587

-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