stas 2004/10/18 16:21:07
Modified: t/lib/TestCommon Utils.pm Log: - perl 5.8.0 (only) croaks on eval {} block at compile time when it thinks the application is setgid. workaround: that's why we need to shutdown compile time errors for this function - also pick up the simpler solution for is_tainted from perlsec and further optimize it not to allocate any temp memory, since @_ may include huge strings Revision Changes Path 1.4 +11 -7 modperl-2.0/t/lib/TestCommon/Utils.pm Index: Utils.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/lib/TestCommon/Utils.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- Utils.pm 18 Oct 2004 02:26:04 -0000 1.3 +++ Utils.pm 18 Oct 2004 23:21:07 -0000 1.4 @@ -1,12 +1,16 @@ package TestCommon::Utils; -sub is_tainted { - my $data = shift; - # the append of " " is crucial with older Perls (5.6), which won't - # consider a scalar with PV = ""\0 as tainted, even though it has - # the taint magic attached - eval { eval $data . " " }; - return ($@ && $@ =~ qr/Insecure dependency in eval/) ? 1 : 0; +use strict; +use warnings FATAL => 'all'; + +BEGIN { + # perl 5.8.0 (only) croaks on eval {} block at compile time when + # it thinks the application is setgid. workaround: that's why we + # need to shutdown compile time errors for this function + local $SIG{__DIE__} = sub { }; + sub is_tainted { + return ! eval { eval join '', map { substr $_, 0, 0 } @_; 1}; + } } 1;