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

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
March 29, 2021 00:12
Subject:
Re: Perl 7: Fix string leaks?
Message ID:
CAExogxPA9dEHc4=jgaKtb=6QzKj5oGNuf4+wkKQm_QUjCMKfNA@mail.gmail.com
Does this mean that mkdir can be allowed to pass a string that has UTF8
flag?

Currently, I think that the correct behavior of Perl5 is that the bytes are
passed to mkdir.

For example, bytes means cp932 in windows, or UTF-8 in Mac or Linux/UNIX.








2021年3月27日(土) 20:48 Felipe Gasper <felipe@felipegasper.com>:

> If “gently breaking” changes in Perl 7 are possible, would fixing these
> conspicuous leaks in Perl’s string storage abstraction be possible?
>
> 1) Change the default XS typemap such that `char *` and `const char *` use
> SvPVbyte_nolen. The status quo here uses SvPV_nolen, which leaks the SV
> internals without giving the XS code any means to “recover” from the leak
> (i.e. to query the SV’s UTF8 bit).
>
> 2) Change exec, mkdir, et al. to use SvPVbyte_nolen rather than
> SvPV_nolen. This fixes the same problem. It’s what CPAN Sys::Binmode does
> currently; this would apply that change to core instead.
>
> Both of these will break code that decodes strings without manually
> encoding them for output to a byte layer, so they’re not really workable in
> Perl 5. But they’re also eminent examples of desirable-but-breaking fixes.
>
> I’m happy to work on these when/if it’s decided that they’re agreeable.
>
> cheers,
> -Felipe

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