develooper Front page | perl.perl5.porters | Postings from April 2006

[perl #39028] lc/uc/lcfirst/ucfirst don't taint empty strings

Thread Next
From:
Nicholas Clark
Date:
April 29, 2006 06:04
Subject:
[perl #39028] lc/uc/lcfirst/ucfirst don't taint empty strings
Message ID:
rt-3.0.11-39028-132853.16.788235812839@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #39028]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=39028 >



This is a bug report for perl from nick@ccl4.org,
generated with the help of perlbug 1.35 running under perl v5.8.8.


-----------------------------------------------------------------
[Please enter your report here]

Is it a bug that under use locale; an empty string doesn't get tainted by
uc/lc/ucfirst/lcfirst:

$ ./perl -Ilib -MDevel::Peek -T -e 'foreach ("", "a") {use locale; Dump lc $_}'
SV = PV(0x81be060) at 0x81bdb58
  REFCNT = 1
  FLAGS = (PADTMP,POK,pPOK)
  PV = 0x81971f0 ""\0
  CUR = 0
  LEN = 4
SV = PVMG(0x81cc940) at 0x81bdb58
  REFCNT = 1
  FLAGS = (PADTMP,GMG,SMG,pPOK)
  IV = 0
  NV = 0
  PV = 0x81971f0 "a"\0
  CUR = 1
  LEN = 4
  MAGIC = 0x81dc5a0
    MG_VIRTUAL = &PL_vtbl_taint
    MG_TYPE = PERL_MAGIC_taint(t)
    MG_LEN = 1


The lack of taint is due to loops being protected by "if (len)"
I'm not sure if this inconsistent behaviour is considered a bug.

Nicholas Clark

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.8.8:

Configured by nick at Fri Apr 28 14:22:57 BST 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=freebsd, osvers=5.3-release-p28, archname=i386-freebsd-thread-multi
    uname='freebsd saigo.etla.org 5.3-release-p28 freebsd 5.3-release-p28 #0: wed mar 29 21:59:21 bst 2006 root@saigo.etla.org:usrobjusrsrcsyssaigo i386 '
    config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list=  -Dinc_version_list_init=0 -Doptimize=-g -Dusethreads -Uuse64bitint -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/snap5.8.x-27996 -Dinstallman1dir=none -Dinstallman3dir=none -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef 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='ccache gcc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include',
    optimize='-g',
    cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include'
    ccversion='', gccversion='3.4.2 [FreeBSD] 20040728', 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='gcc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lm -lcrypt -lutil -lc_r
    perllibs=-lm -lcrypt -lutil -lc_r
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fPIC', lddlflags='-shared  -L/usr/local/lib'

Locally applied patches:
    MAINT27284

---
@INC for perl v5.8.8:
    lib
    /home/nick/Sandpit/snap5.8.x-27996/lib/perl5/5.8.8/i386-freebsd-thread-multi
    /home/nick/Sandpit/snap5.8.x-27996/lib/perl5/5.8.8
    /home/nick/Sandpit/snap5.8.x-27996/lib/perl5/site_perl/5.8.8/i386-freebsd-thread-multi
    /home/nick/Sandpit/snap5.8.x-27996/lib/perl5/site_perl/5.8.8
    /home/nick/Sandpit/snap5.8.x-27996/lib/perl5/site_perl
    .

---
Environment for perl v5.8.8:
    HOME=/home/nick
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/nick/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/nick/bin:/usr/local/sbin:/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/usr/local/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