develooper Front page | perl.perl5.porters | Postings from July 2012

[perl #114242] TryCatch toke error with (??{$any}) $ws \\] )? @

Thread Next
From:
rurban @ cpanel . net
Date:
July 23, 2012 07:21
Subject:
[perl #114242] TryCatch toke error with (??{$any}) $ws \\] )? @
Message ID:
rt-3.6.HEAD-11172-1343053287-1049.114242-75-0@perl.org
# New Ticket Created by  rurban@cpanel.net 
# Please include the string:  [perl #114242]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114242 >



This is a bug report for perl from rurban@cpanel.net,
generated with the help of perlbug 1.39 running under perl 5.17.2.


-----------------------------------------------------------------
The toke.c part for compiling a (?{..}) expression creates an invalid string.

The string "(??{$any})  $ws \\] )? @" which appears in TryCatch 
creates for
toke.c:
4702		    NEXTVAL_NEXTTOKE.opval =
4703			    (OP*)newSVOP(OP_CONST, 0,
4704				newSVpvn(PL_sublex_info.re_eval_start,
4705					PL_bufptr - PL_sublex_info.re_eval_start));
a negative length:
(gdb) p PL_bufptr
$2 = 0x105f054 "  $ws \\] )? "
(gdb) p  PL_sublex_info
$3 = {super_state = 10 '\n', sub_inwhat = 31, sub_op = 0x1067f08,
super_bufptr = 0x0, super_bufend = 0x0, 
  re_eval_start = 0x10655fa "(??{$any})  $ws \\] )? @"}

repro:
gdb --args /usr/local/bin/perl5.17.2d-nt -Mblib t/invalid.t
(gdb) b sv.c:4469
# panic: sv_setpvn called with negative strlen
(gdb) bt
#0  Perl_sv_setpvn (sv=0x1069db0, ptr=0x10655fa "(??{$any})  $ws \\] )? @",
#len=18446744073709525594) at sv.c:4469
#1  0x00007ffff7bc77d3 in Perl_newSVpvn (buffer=0x10655fa "(??{$any})  $ws
#\\] )? @", len=18446744073709525594) at sv.c:8400
#2  0x00007ffff7a7ad42 in Perl_yylex () at toke.c:4703
#3  0x00007ffff7aac794 in Perl_yyparse (gramtype=258) at perly.c:334
#4  0x00007ffff7c35a5c in S_doeval (gimme=2, outside=0x0, seq=6541, hh=0x0)
#at pp_ctl.c:3449
#5  0x00007ffff7c3c671 in Perl_pp_require () at pp_ctl.c:4003
(gdb) up 2
...

-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl 5.17.2:

Configured by rurban at Fri Jul 20 13:46:41 CDT 2012.

Summary of my perl5 (revision 5 version 17 subversion 2) configuration:
   
  Platform:
    osname=linux, osvers=3.2.0-2-amd64, archname=x86_64-linux-debug
    uname='linux reini 3.2.0-2-amd64 #1 smp mon may 21 17:45:41 utc 2012 x86_64 gnulinux '
    config_args='-de -Dusedevel -Dinstallman1dir=none -Dinstallman3dir=none -Dinstallsiteman1dir=none -Dinstallsiteman3dir=none -DEBUGGING -Doptimize=-g3 -Uuseithreads -Accflags='-msse4.2' -Accflags='-march=corei7' -Dcf_email='rurban@cpanel.net' -Dperladmin='rurban@cpanel.net' -Duseshrplib'
    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 ='-msse4.2 -march=corei7 -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g3',
    cppflags='-msse4.2 -march=corei7 -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.7.1', 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/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.13'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/local/lib/perl5/5.17.2/x86_64-linux-debug/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -g3 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.17.2:
    /usr/local/lib/perl5/site_perl/5.17.2/x86_64-linux-debug
    /usr/local/lib/perl5/site_perl/5.17.2
    /usr/local/lib/perl5/5.17.2/x86_64-linux-debug
    /usr/local/lib/perl5/5.17.2
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl 5.17.2:
    HOME=/home/rurban
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/rurban/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


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