List Info

Thread: Re: $1 suddenly tainted after regexp on utf-8 string




Re: $1 suddenly tainted after regexp on utf-8 string
user name
2007-11-06 10:34:52
use more 'coffee';

On Tue, Nov 06, 2007 at 03:59:01PM +0000, Nicholas Clark
wrote:

> It's in still in blead. I thought that it was something
to do with the swash
> loading code:
> 
> $ cat 47195.pl
> my $line = 'A1' . substr ($^X, 0, 0) . chr shift;
> chop $line;
> $line =~ /(AS*)/;
> print eval { join("",$1), kill 0; 1 } ?
"untaintedn" : "taintedn";
> 
> my $line = 'A1' . substr ($^X, 0, 0) . chr shift;
> chop $line;
> $line =~ /(AS*)/;
> print eval { join("",$1), kill 0; 1 } ?
"untaintedn" : "taintedn";
> 
> __END__
> $ ./perl -Ilib -T 47195.pl 256
> tainted
> untainted
> 
> 
> But it doesn't seem to be, because if I change the
program to be a loop:
> 
> $ cat 47195.pl
> for (0..1) {
>     my $line = 'A1' . substr ($^X, 0, 0) . chr
$ARGV[0];
>     chop $line;
>     $line =~ /(AS*)/;
>     print eval { join("",$1), kill 0; 1 } ?
"untaintedn" : "taintedn";
> }

Then I had to change shift, which I didn't realise I'd not
done in the first
example.

Therefore, it's nothing to do with the swatch *loading*
code.

Nicholas Clark

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )