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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
From:
=?UTF-8?Q?Salvador_Fandi=c3=b1o?=
Date:
March 31, 2021 06:45
Subject:
Re: Perl 7: Fix string leaks?
Message ID:
c296dcd9-4c56-9e71-5c78-f6ecbe7a4f4e@gmail.com
On 31/3/21 0:30, Dan Book wrote:
> On Tue, Mar 30, 2021 at 4:48 PM Salvador FandiƱo <sfandino@gmail.com 
> <mailto:sfandino@gmail.com>> 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About