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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
From:
Ben Bullock
Date:
April 1, 2021 01:24
Subject:
Re: Perl 7: Fix string leaks?
Message ID:
CAN5Y6m_=eimX_O95A01Hz8a5DyYs2xmnE4+AxLHSwhqPbHzjXQ@mail.gmail.com
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.

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.

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