Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tainted values become untainted in tied hashes #3833

p5pRT opened this issue Apr 6, 2001 · 5 comments

tainted values become untainted in tied hashes #3833

p5pRT opened this issue Apr 6, 2001 · 5 comments


Copy link

@p5pRT p5pRT commented Apr 6, 2001

Migrated from (status was 'resolved')

Searchable as RT6758$

Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 6, 2001


Using a tied hash untaints the values stored in the hash under perl 5.6.0
(both Solaris 5.6 and Windows (Active Perl). Here's an example program
that demonstrates the problem​:

  #!/usr/local/bin/perl5 -T

  package IHash ;

  sub check_tainted
  my $type = shift ;
  my $value = shift ;
  my $istainted = ! eval { my $x = $value, kill 0 ; 1 } ;
  print $istainted ? "TAINTED​: " : 'not tainted​: ' ;
  print "$type = $value\n" ;

  sub STORE
  my $this = shift ;
  my $key = shift ;
  my $value = shift ;
  check_tainted('key', $key) ;
  check_tainted('value', $value) ;

  my $class = shift ;
  my $this = {} ;
  return bless $this => $class ;

  package main ;

  my %hash ;

  tie %hash, 'IHash' ;
  my $key = shift @​ARGV ;
  my $value = shift @​ARGV ;
  IHash​::check_tainted('original key', $key) ;
  IHash​::check_tainted('original value', $value) ;

  $hash{$key} = $value ;

When run with arguments of 'arg1' and 'arg2' on the command line, it
produces the following output​:

  TAINTED​: original key = arg1
  TAINTED​: original value = arg2
  TAINTED​: key = arg1
  not tainted​: value = arg2

Perl Info


Site configuration information for perl v5.6.0:

Configured by phanson at Wed Sep  6 18:10:35 PDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos well 5.6 generic_105181-21 sun4u sparc sunw,ultra-4 '
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
    cc='gcc', optimize='-O', gccversion=2.8.1
    cppflags='-I/usr/local/BerkeleyDB/include -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    ccflags ='-I/usr/local/BerkeleyDB/include -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags ='-L/usr/local/BerkeleyDB/lib -L/usr/local/lib '
    libpth=/usr/local/BerkeleyDB/lib /usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt -lsec
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl'
    cccdlflags='-fPIC', lddlflags='-W,l -G -L/usr/local/BerkeleyDB/lib -L/usr/local/lib'

Locally applied patches:

@INC for perl v5.6.0:

Environment for perl v5.6.0:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Copy link
Collaborator Author

@p5pRT p5pRT commented May 8, 2003

From @iabyn

still present in bleedperl@​19435

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 10, 2004

From @muir

Still present in 5.8.3

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 20, 2010

From @iabyn

This has been fixed by commit b112cff
in the branch davem/post-5.12 which should be merged back into blead
once 5.12 has been released, and thus appear in 5.14.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 20, 2010

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.