develooper Front page | perl.perl5.porters | Postings from October 2016

[perl #129826] Invalid read of size 8 in S_parse_body (perl.c:2166)when argv ends with --

From:
Stefan Seifert
Date:
October 7, 2016 18:52
Subject:
[perl #129826] Invalid read of size 8 in S_parse_body (perl.c:2166)when argv ends with --
Message ID:
rt-4.0.24-5880-1475850910-236.129826-75-0@perl.org
# New Ticket Created by  Stefan Seifert 
# Please include the string:  [perl #129826]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=129826 >



This is a bug report for perl from nine@detonation.org,
generated with the help of perlbug 1.40 running under perl 5.24.0.


-----------------------------------------------------------------
When perl is run with a command line that ends in "--" as in:
perl -e 0 --
S_parse_body will do an invalid memory access trying to set
scriptname to argv[0] which by then points after the -- and thus
outside the original arguments list.

Noticed by valgrinding Inline::Perl5 which embeds perl in Perl 6.
I failed to reproduce the valgrind output with just running perl
because probably valgrind thinks the -- is part of its own command
line.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
This perlbug was built using Perl 5.24.0 - Thu Sep  1 15:14:40 UTC 2016
It is being executed now by  Perl 5.24.0 - Thu Sep  1 15:11:43 UTC 2016.

Site configuration information for perl 5.24.0:

Configured by abuild at Thu Sep  1 15:11:43 UTC 2016.

Summary of my perl5 (revision 5 version 24 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=4.7.2-1-default, archname=x86_64-linux-thread-multi
    uname='linux lamb13 4.7.2-1-default #1 smp preempt sun aug 21 08:59:11 utc 2016 (34ba8d6) x86_64 x86_64 x86_64 gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true -Doptimize=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl -Dinc_version_list=none'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong'
    ccversion='', gccversion='6.2.1 20160830 [gcc-6-branch revision 239856]', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector-strong'
    libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/6/include-fixed /usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lm -ldl -lcrypt -lpthread
    perllibs=-lm -ldl -lcrypt -lpthread
    libc=/lib64/libc-2.23.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.23'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.24.0/x86_64-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 -fstack-protector-strong'


---
@INC for perl 5.24.0:
    /home/nine/work/lib
    /usr/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi
    /usr/lib/perl5/site_perl/5.24.0
    /usr/lib/perl5/vendor_perl/5.24.0/x86_64-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.24.0
    /usr/lib/perl5/5.24.0/x86_64-linux-thread-multi
    /usr/lib/perl5/5.24.0
    /usr/lib/perl5/site_perl
    .

---
Environment for perl 5.24.0:
    HOME=/home/nine
    LANG=en_US.UTF-8
    LANGUAGE=
    LC_COLLATE=de_AT.UTF-8
    LC_MEASUREMENT=de_AT.UTF-8
    LC_MONETARY=de_AT.UTF-8
    LC_NUMERIC=en_US.UTF-8
    LC_TIME=de_AT.UTF-8
    LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/osgPlugins
    LOGDIR (unset)
    PATH=/home/nine/perl5/perlbrew/bin:/home/nine/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/opt/kde3/bin:/opt/kde2/bin:/opt/kde/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/sbin:/opt/FlightGear/bin:/home/nine/rakudo/install/bin:/home/nine/rakudo/install/share/perl6/site/bin:/opt/FlightGear/bin:/home/nine/rakudo/install/bin:/home/nine/rakudo/install/share/perl6/site/bin:/usr/sbin:/opt/FlightGear/bin:/home/nine/rakudo/install/bin:/home/nine/rakudo/install/share/perl6/site/bin
    PERL5LIB=/home/nine/work/lib
    PERLBREW_BASHRC_VERSION=0.42
    PERLBREW_HOME=/home/nine/.perlbrew
    PERLBREW_MANPATH=
    PERLBREW_PATH=/home/nine/perl5/perlbrew/bin
    PERLBREW_PERL=
    PERLBREW_ROOT=/home/nine/perl5/perlbrew
    PERLBREW_VERSION=0.42
    PERL_BADLANG (unset)
    SHELL=/bin/bash




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About