FAQ
Or worse ...
perl -MEncode -e 'encode("latin-1", "\x{0646}", sub{ my $x });'
Segmentation fault

On 5/28/07, Tatsuhiko Miyagawa wrote:
perl -MEncode -e 'print encode("euc-jp", "\x{0646}", sub { my $x = $_[0] });'
Segmentation fault
perl -MEncode -le 'print $Encode::VERSION'
2.21
--
Tatsuhiko Miyagawa

Search Discussions

  • Dan Kogai at May 29, 2007 at 4:55 am

    On May 29, 2007, at 12:58 , Tatsuhiko Miyagawa wrote:
    Or worse ...
    perl -MEncode -e 'encode("latin-1", "\x{0646}", sub{ my $x });'
    Segmentation fault
    On 5/28/07, Tatsuhiko Miyagawa wrote:
    perl -MEncode -e 'print encode("euc-jp", "\x{0646}", sub { my $x
    = $_[0] });'
    Segmentation fault
    perl -MEncode -le 'print $Encode::VERSION'
    2.21
    I believe I found the reason.
    % /usr/bin/perl -Mblib -MEncode -e 'warn Encode->VERSION; print
    encode("euc-jp", "\x{0646}", sub { my $x = $_[0] });'
    2.20 at -e line 1.
    Segmentation fault
    % -MEncode -e 'warn Encode->VERSION; $u="\x{0646}"; print encode
    ("euc-jp", $u, sub { my $x = $_[0] });
    '2.08 at -e line 1.
    Encode tries to write on the constant. If it were done perl croaks
    for you but Encode (Encode::XS to be exact) does it in XS so segfaults.

    Strangely it did not happen on FreeBSD.

    At any rate I'll release the fix ASAP.

    Dan the Maintainer Thereof
  • Tatsuhiko Miyagawa at May 29, 2007 at 5:02 am
    Hm, even if I assign the string into a variable before doing encode(),
    it does segfault.
    perl -MEncode -e 'warn Encode->VERSION;$u = "\x{0646}"; encode("latin-1", $u, sub{ my $x });'
    2.21 at -e line 1.
    Segmentation fault

    I tested with:

    This is perl, v5.8.4 built for i386-linux-thread-multi

    but apparently it does with 5.8.8 on Mac OSX as well, according to Jesse here.

    Thanks,
    On 5/29/07, Dan Kogai wrote:
    On May 29, 2007, at 12:58 , Tatsuhiko Miyagawa wrote:
    Or worse ...
    perl -MEncode -e 'encode("latin-1", "\x{0646}", sub{ my $x });'
    Segmentation fault
    On 5/28/07, Tatsuhiko Miyagawa wrote:
    perl -MEncode -e 'print encode("euc-jp", "\x{0646}", sub { my $x
    = $_[0] });'
    Segmentation fault
    perl -MEncode -le 'print $Encode::VERSION'
    2.21
    I believe I found the reason.
    % /usr/bin/perl -Mblib -MEncode -e 'warn Encode->VERSION; print
    encode("euc-jp", "\x{0646}", sub { my $x = $_[0] });'
    2.20 at -e line 1.
    Segmentation fault
    % -MEncode -e 'warn Encode->VERSION; $u="\x{0646}"; print encode
    ("euc-jp", $u, sub { my $x = $_[0] });
    '2.08 at -e line 1.
    Encode tries to write on the constant. If it were done perl croaks
    for you but Encode (Encode::XS to be exact) does it in XS so segfaults.

    Strangely it did not happen on FreeBSD.

    At any rate I'll release the fix ASAP.

    Dan the Maintainer Thereof

    --
    Tatsuhiko Miyagawa

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedMay 29, '07 at 3:59a
activeMay 29, '07 at 5:02a
posts3
users2
websiteperl.org

2 users in discussion

Tatsuhiko Miyagawa: 2 posts Dan Kogai: 1 post

People

Translate

site design / logo © 2022 Grokbase