Skip Menu |
 
Report information
Id: 73814
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: mmaslano <mmaslano [at] redhat.com>
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: High
Type:
  • core
  • CoreDump
  • Unicode
Perl Version: 5.10.1
Fixed In: (no value)

Attachments
0001-RT-73814-unpack-didn-t-handle-scalar-context-cor.patch



Subject: unpack leads to segmentation fault
Date: Thu, 25 Mar 2010 09:17:06 -0400 (EDT)
To: perlbug [...] perl.org
From: Marcela Maslanova <mmaslano [...] redhat.com>
Download (untitled) / with headers
text/plain 5.9k
This is a bug report for perl from mmaslano@redhat.com, generated with the help of perlbug 1.39 running under perl 5.10.1. ----------------------------------------------------------------- [Please describe your issue here] From the original report by Richard W.M. Jones https://bugzilla.redhat.com/show_bug.cgi?id=576824 Description of problem: $ perl -e 'use bytes; print join(",",split(/../,unpack("%02H*","hello world")))' Segmentation fault Version-Release number of selected component (if applicable): perl-5.10.1-117.fc14.x86_64 How reproducible: Always. Steps to Reproduce: 1. Run the above command. Actual results: Core dump. Stack trace: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7d56670 in Perl_pp_split (my_perl=0x602010) at pp.c:4619 4619 rx = PM_GETRE(pm); (gdb) bt #0 0x00007ffff7d56670 in Perl_pp_split (my_perl=0x602010) at pp.c:4619 #1 0x00007ffff7d36656 in Perl_runops_standard (my_perl=0x602010) at run.c:40 #2 0x00007ffff7cdf088 in S_run_body (oldscope=<value optimized out>, my_perl=<value optimized out>) at perl.c:2431 #3 perl_run (oldscope=<value optimized out>, my_perl=<value optimized out>) at perl.c:2349 #4 0x0000000000400c5c in main (argc=3, argv=0x7fffffffe448, env=0x7fffffffe468) at perlmain.c:117 The segmentation faul could be also reproduced on: perl -e 'print split(/../,unpack("%02H*","hello world"))' I've reproduced this bug also with perl-5.11.4. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=library severity=low module=base --- This perlbug was built using Perl 5.10.1 in the Fedora build system. It is being executed now by Perl 5.10.1 - Sun Mar 7 06:02:09 UTC 2010. Site configuration information for perl 5.10.1: Configured by Red Hat, Inc. at Sun Mar 7 06:02:09 UTC 2010. Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=2.6.18-164.6.1.el5, archname=x86_64-linux-thread-multi uname='linux x86-02.phx2.fedoraproject.org 2.6.18-164.6.1.el5 #1 smp tue oct 27 11:28:30 edt 2009 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DDEBUGGING=-g -Accflags=-DPERL_USE_SAFE_PUTENV -Dversion=5.10.1 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5 -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5 -Dinc_version_list=5.10.0 -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dotherlibdirs=/usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi:/usr/local/lib/perl5/site_perl/5.10.0:/usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi:/usr/lib/perl5/vendor_perl:/usr/lib/perl5/site_perl' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic', cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.4.3 20100211 (Red Hat 4.4.3-6)', 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='gcc', ldflags =' -fstack-protector' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.11.90' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' Locally applied patches: --- @INC for perl 5.10.1: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/local/share/perl5 /usr/lib64/perl5 /usr/share/perl5 /usr/share/perl5 /usr/lib64/perl5 /usr/share/perl5 /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl . --- Environment for perl 5.10.1: HOME=/home/marca LANG=en_US.UTF-8 LANGUAGE= LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/lib64/ccache:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/usr/sbin:/sbin:/home/marca/bin PERL_BADLANG (unset) SHELL=/bin/bash
Subject: Re: [perl #73814] unpack leads to segmentation fault
Date: Fri, 26 Mar 2010 10:57:27 +0100
To: Perl 5 Porters <perl5-porters [...] perl.org>
From: Rafael Garcia-Suarez <rgs [...] consttype.org>
Download (untitled) / with headers
text/plain 483b
On 25 March 2010 14:17, Marcela Maslanova <perlbug-followup@perl.org> wrote: Show quoted text
> Description of problem: > > $ perl -e 'use bytes; > print join(",",split(/../,unpack("%02H*","hello world")))' > Segmentation fault
Shorter test case : $ ./perl -e 'split/a/,unpack("%02H*","a")' Segmentation fault Looks like split has difficulties with its argument list there, which boils down apparently to unpack returning too many values : $ perl -le 'print for scalar unpack("%02H*","a")' 61 0
CC: Perl 5 Porters <perl5-porters [...] perl.org>
Subject: Re: [perl #73814] unpack leads to segmentation fault
Date: Fri, 23 Apr 2010 19:56:51 +1000
From: Tony Cook <tony [...] develop-help.com>
Download (untitled) / with headers
text/plain 703b
On Fri, Mar 26, 2010 at 10:57:27AM +0100, Rafael Garcia-Suarez wrote: Show quoted text
> On 25 March 2010 14:17, Marcela Maslanova <perlbug-followup@perl.org> wrote:
> > Description of problem: > > > > $ perl -e 'use bytes; > > print join(",",split(/../,unpack("%02H*","hello world")))' > > Segmentation fault
> > Shorter test case : > > $ ./perl -e 'split/a/,unpack("%02H*","a")' > Segmentation fault > > Looks like split has difficulties with its argument list there, which > boils down apparently to unpack returning too many values : > > $ perl -le 'print for scalar unpack("%02H*","a")' > 61 > 0
The H and u formats were returning the unpack()ed text as well as the checksum. Patch with tests attached. Tony

Message body is not shown because sender requested not to inline it.

CC: Perl 5 Porters <perl5-porters [...] perl.org>
Subject: Re: [perl #73814] unpack leads to segmentation fault
Date: Fri, 30 Apr 2010 14:34:33 +0200
To: Tony Cook <tony [...] develop-help.com>
From: Rafael Garcia-Suarez <rgs [...] consttype.org>
Download (untitled) / with headers
text/plain 256b
On 23 April 2010 11:56, Tony Cook <tony@develop-help.com> wrote: Show quoted text
> The H and u formats were returning the unpack()ed text as well as the > checksum. > > Patch with tests attached.
Thanks, applied to bleadperl as 858fe5e170d95536de0f761c14ed083ad288eae8.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org