Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart match that causes segfaults. #11764

Open
p5pRT opened this issue Nov 21, 2011 · 5 comments
Open

Smart match that causes segfaults. #11764

p5pRT opened this issue Nov 21, 2011 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 21, 2011

Migrated from rt.perl.org#104162 (status was 'open')

Searchable as RT104162$

@p5pRT
Copy link
Author

p5pRT commented Nov 21, 2011

From tobyink@cpan.org

This is a bug report for perl from tobyink@​cpan.org,
generated with the help of perlbug 1.39 running under perl 5.10.1.


The following code segfaults in 5.10.1 and 5.14.2 (and presumably
everything in between) on Linux and probably other platforms​:

use 5.010;
my $a = [qw/a A/];
my $b = ['b', $a, 'B'];
push @​$a, $b;
say 'hurrah' if 'B' ~~ $b;

While this kind of error probably should indeed die (it doesn't
make sense to use a cyclical structure for smart matching), it
shouldn't be a segfault but rather an error that can be caught by
'eval'.

This could probably be fixed by having the smart match operator
maintain a list of references it has "visited" and refuse to revisit
a previously visited reference.

(In addition, my mail server seems to reject e-mails sent using the
perlbug program, claiming they don't contain valid Date and From
headers. So I'm sending this message through my e-mail client instead.)



Flags​:
  category=core
  severity=high


Site configuration information for perl 5.10.1​:

Configured by Mandriva at Fri Jun 11 13​:12​:00 EDT 2010.

Summary of my perl5 (revision 5 version 10 subversion 1) configuration​:
 
  Platform​:
  osname=linux, osvers=2.6.27.45-server-1mnb,
archname=i386-linux-thread-multi uname='linux titan.mandriva.com
2.6.27.45-server-1mnb #1 smp fri jan 29 15​:41​:43 est 2010 i686 intel(r)
xeon(r) cpu x3360 @​ 2.83ghz gnulinux ' config_args='-des
-Dinc_version_list=5.10.0 5.10.0/i386-linux-thread-multi 5.8.8 5.8.7
5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.6.1 5.6.0
-Darchname=i386-linux -Dcc=i586-mandriva-linux-gnu-gcc -Doptimize=-O2
-g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4
-fomit-frame-pointer -march=i586 -mtune=generic
-fasynchronous-unwind-tables -DDEBUGGING=-g -Dprefix=/usr
-Dvendorprefix=/usr -Dsiteprefix=/usr -Dsitebin=/usr/local/bin
-Dsiteman1dir=/usr/local/share/man/man1
-Dsiteman3dir=/usr/local/share/man/man3 -Dman3ext=3pm -Dcf_by=Mandriva
-Dmyhostname=localhost -Dperladmin=root@​localhost
-Dcf_email=root@​localhost -Dd_dosuid -Ud_csh -Duseshrplib -Duseithreads
-Di_db -Di_ndbm -Di_gdbm' hint=recommended, useposix=true,
d_sigaction=define useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef Compiler​:
cc='i586-mandriva-linux-gnu-gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g -pipe
-Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer
-march=i586 -mtune=generic -fasynchronous-unwind-tables',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include' ccversion='',
gccversion='4.4.1', gccosandvers='' intsize=4, longsize=4, ptrsize=4,
doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8,
d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4,
nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4,
prototype=define Linker and Libraries​:
ld='i586-mandriva-linux-gnu-gcc', ldflags =' -fstack-protector
-L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm
-ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat perllibs=-lnsl
-ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.10.1.so, so=so,
useshrplib=true, libperl=libperl.so gnulibc_version='2.10.1' Dynamic
Linking​: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.10.1/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wformat
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer
-march=i586 -mtune=generic -fasynchronous-unwind-tables
-L/usr/local/lib'

Locally applied patches​:
  Mandriva Linux patches


@​INC for perl 5.10.1​:
  /usr/lib/perl5/site_perl/5.10.1/i386-linux-thread-multi
  /usr/lib/perl5/site_perl/5.10.1
  /usr/lib/perl5/vendor_perl/5.10.1/i386-linux-thread-multi
  /usr/lib/perl5/vendor_perl/5.10.1
  /usr/lib/perl5/5.10.1/i386-linux-thread-multi
  /usr/lib/perl5/5.10.1
  /usr/lib/perl5/site_perl
  /usr/lib/perl5/vendor_perl/5.10.0
  /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
  /usr/lib/perl5/vendor_perl
  .


Environment for perl 5.10.1​:
  HOME=/home/tai
  LANG=en_GB.UTF-8
  LANGUAGE=en_GB.UTF-8​:en_GB​:en
  LC_ADDRESS=en_GB.UTF-8
  LC_COLLATE=en_GB.UTF-8
  LC_CTYPE=en_GB.UTF-8
  LC_IDENTIFICATION=en_GB.UTF-8
  LC_MEASUREMENT=en_GB.UTF-8
  LC_MESSAGES=en_GB.UTF-8
  LC_MONETARY=en_GB.UTF-8
  LC_NAME=en_GB.UTF-8
  LC_NUMERIC=en_GB.UTF-8
  LC_PAPER=en_GB.UTF-8
  LC_SOURCED=1
  LC_TELEPHONE=en_GB.UTF-8
  LC_TIME=en_GB.UTF-8
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/tai/perl5/perlbrew/bin​:/home/tai/bin​:/bin​:/usr/bin​:/usr/local/bin​:/usr/games​:/usr/lib/qt4/bin​:/home/tai/bin​:/opt/parrot/bin
  PERLBREW_PATH=/home/tai/perl5/perlbrew/bin
  PERLBREW_ROOT=/home/tai/perl5/perlbrew
  PERLBREW_VERSION=0.29
  PERL_BADLANG (unset)
  SHELL=/bin/tcsh

--
Toby A Inkster
<mailto​:mail@​tobyinkster.co.uk>
<http​://tobyinkster.co.uk>

@p5pRT
Copy link
Author

p5pRT commented Dec 5, 2011

From @jkeenan

On Mon Nov 21 02​:05​:57 2011, tobyink@​cpan.org wrote​:

The following code segfaults in 5.10.1 and 5.14.2 (and presumably
everything in between) on Linux and probably other platforms​:

use 5.010;
my $a = [qw/a A/];
my $b = ['b', $a, 'B'];
push @​$a, $b;
say 'hurrah' if 'B' ~~ $b;

Note that if we switch the positions of 'b' and 'B' in the second
arrayref, the program DWIMs​:

$ cat 104162.pl
use feature qw( :5.10 );
my $x = [qw/a A/];
my $y = ['B', $x, 'b'];
push @​$x, $y;
say 'hurrah' if 'B' ~~ $y;

$ perl 104162.pl
hurrah

@p5pRT
Copy link
Author

p5pRT commented Dec 5, 2011

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 11, 2012

From tobyink@cpan.org

On the newly released 5.16.0-RC0, the following still segfaults​:

perl -E'my $a = [qw/a A/]; my $b = ["b", $a, "B"]; push @​$a, $b; say
"hurrah" if 'B' ~~ $b;'

@p5pRT
Copy link
Author

p5pRT commented May 11, 2012

From [Unknown Contact. See original ticket]

On the newly released 5.16.0-RC0, the following still segfaults​:

perl -E'my $a = [qw/a A/]; my $b = ["b", $a, "B"]; push @​$a, $b; say
"hurrah" if 'B' ~~ $b;'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants