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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
Salvador Fandiño
March 31, 2021 06:45
Re: Perl 7: Fix string leaks?
Message ID:
On 31/3/21 0:30, Dan Book wrote:
> On Tue, Mar 30, 2021 at 4:48 PM Salvador Fandiño < 
> <>> wrote:
>      >> No solution is trivial or evident, and would have required
>     investigation from the developer. So, I would expect most people did
>     find about 2 and used it.
>      >
>      > A lot of XS modules use SvPV without checking SvUTF8. Alas.
>     Yes, and almost all of them are broken!
> Technically yes, but practically is a different matter. Such modules (1) 
> accidentally work correctly sometimes, and (2) work correctly always on 
> ascii-only input. Fixing this wholesale, as in most instances of this 
> bug, won't affect (2) but it will cause (1) to go from "sometimes 
> broken" to "always broken".

Well, some of those "sometimes broken" would also change to "fixed".

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.

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