evalEmpire / perl5i

A single module to fix as much of Perl 5 as possible in one go
http://search.cpan.org/perldoc?perl5i
Other
156 stars 42 forks source link

segmentation fault in string #164

Closed tokuhirom closed 13 years ago

tokuhirom commented 14 years ago
perl5i -e 'my $x; my $y; "@{[ $x->$y ]}"'

makes core.

(gdb) run
Starting program: /home/disk-firstaid/app/perl-5.12.1/bin/perl5i -e my\ \$x\;\ my\ \$y\;\ \"@\{\[\ \$x-\>\$y\ \]\}\"
process 21181 is executing new program: /home/disk-firstaid/app/perl-5.12.1/bin/perl

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff46d08b8 in indirect_ck_method () from /usr/local/app/perl-5.12.1/lib/site_perl/5.12.1/x86_64-linux/auto/indirect/indirect.so
(gdb) bt
#0  0x00007ffff46d08b8 in indirect_ck_method () from /usr/local/app/perl-5.12.1/lib/site_perl/5.12.1/x86_64-linux/auto/indirect/indirect.so
#1  0x0000000000426f6c in Perl_newUNOP ()
#2  0x000000000045a527 in Perl_yyparse ()
#3  0x0000000000433f4d in S_parse_body ()
#4  0x0000000000435c5d in perl_parse ()
#5  0x000000000041ff33 in main ()
schwern commented 14 years ago

I cannot replicate. Can you give your perl -V please?

Its likely a problem in indirect. Can you check if this has the same problem?

perl -we 'use indirect; my $x; my $y; "@{[ $x->$y ]}"'
tokuhirom commented 14 years ago
% perl -we 'use indirect; my $x; my $y; "@{[ $x->$y ]}"'
Useless use of string in void context at -e line 1.
Use of uninitialized value $y in method lookup at -e line 1.
Can't call method "" on an undefined value at -e line 1.

Summary of my perl5 (revision 5 version 12 subversion 1) configuration:

  Platform:
    osname=linux, osvers=2.6.32-22-server, archname=x86_64-linux
    uname='linux gpath 2.6.32-22-server #33-ubuntu smp wed apr 28 14:34:48 utc 2010 x86_64 gnulinux '
    config_args='-des -Duse64bitint -Dprefix=/usr/local/app/perl-5.12.1/'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.3', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.11.1.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.1'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl):
  Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
                        USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
                        USE_PERL_ATOF
  Built under linux
  Compiled at May 18 2010 00:52:15
  %ENV:
    PERL_AUTOINSTALL="--defaultdeps"
    PERL_BADLANG="0"
  @INC:
    /usr/local/app/perl-5.12.1/lib/site_perl/5.12.1/x86_64-linux
    /usr/local/app/perl-5.12.1/lib/site_perl/5.12.1
    /usr/local/app/perl-5.12.1/lib/5.12.1/x86_64-linux
    /usr/local/app/perl-5.12.1/lib/5.12.1
    .
tokuhirom commented 14 years ago
% perl -e 'use indirect; BEGIN  { indirect::unimport(__PACKAGE__, ":fatal")  }; my $x; my $y; "@{[ $x->$y ]}"

cause segmentation fault on my machine, too.

tokuhirom commented 14 years ago

It is completely indirect.pm's issue. I'll create RT ticket to indirect.pm :)

tokuhirom commented 14 years ago

ref. https://rt.cpan.org/Ticket/Display.html?id=60378&results=cc5682744d75680675c79cd07bd637d4

schwern commented 14 years ago

Thanks! Let us know when its fixed and we'll bump the dependency on indirect.

tokuhirom commented 14 years ago

This issue was fixed at 0.22! http://cpansearch.perl.org/src/VPIT/indirect-0.22/Changes

schwern commented 14 years ago

I've bumped the requirement on indirect and written a test to make sure the segfault doesn't happen again. Would you please try out http://github.com/schwern/perl5i/tree/github164 and check that it catches the segfault when using indirect 0.20? And if not, patch it up? I can't reproduce the problem here so I'm flying blind.

tokuhirom commented 14 years ago

Passed all tests in github164 branch with indirect 0.22! thanks.

schwern commented 14 years ago

Thank you, but I need to know that it fails with 0.20.

tokuhirom commented 14 years ago

Oops. sorry.

With indrect 0.20, it fails.

% perl -Ilib t/github164.t
zsh: segmentation fault  perl -Ilib t/github164.t
schwern commented 13 years ago

Fixed by cd7b3248f6d0b1bcceadcf7946f83c0e852b35a4