develooper Front page | perl.perl5.porters | Postings from January 2010

[perl #72354] non-regexps can end up as SVt_REGEXP

Thread Previous | Thread Next
Nicholas Clark
January 26, 2010 08:57
[perl #72354] non-regexps can end up as SVt_REGEXP
Message ID:
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #72354]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.39 running under perl 5.11.4.

[Please describe your issue here]

$ ./perl -lwe '$a = ${qr//}; $a = 2; print re::is_regexp(\$a)'

It is possible for arbitrary SVs (eg PAD entries) to be upgraded to SVt_REGEXP.
(This is new with first class regexps)

Whilst the example above does not SEGV, it will be possible to write code
that will cause SEGVs (or worse) at the point when the scalar is freed,
because the code in sv_clear() assumes that all scalars of type SVt_REGEXP
*are* regexps, and passes them to pregfree2(), which assumes that 
pointers within are valid.

Yes, this should be a 5.12 blocker, because what we have will open us up to

The fix might be simple and clear.

Nicholas Clark

[Please do not change anything below this line]
Site configuration information for perl 5.11.4:

Configured by nick at Sun Jan 24 22:05:35 GMT 2010.

Summary of my perl5 (revision 5 version 11 subversion 4) configuration:
  Commit id: dac9950b46a56f9fb4bccdd7fbcbf06e277767a2
    osname=linux, osvers=, archname=x86_64-linux-thread-multi
    uname='linux eris #1 smp sat oct 3 10:27:42 bst 2009 x86_64 gnulinux '
    config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dinc_version_list=  -Dinc_version_list_init=0 -Doptimize=-g -Dusethreads -Duse64bitall -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/snap5.9.x-v5.11.4-16-gdac9950 -Uusevendorprefix -Uvendorprefix=~/Sandpit/snap5.9.x-v5.11.4-16-gdac9950 -Dinstallman1dir=none -Dinstallman3dir=none -Uuserelocatableinc -de'
    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
    cc='ccache gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.3.2', 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 -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib -fstack-protector'

Locally applied patches:

@INC for perl 5.11.4:

Environment for perl 5.11.4:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About