From: Nicholas Clark Date: Sat, 17 Mar 2007 16:58:00 +0000 (+0000) Subject: Test case from Karl Chen in RT #41831 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=beeaa6fd84e249975eb18188079a8f1f7f8aba4c;p=p5sagit%2Fp5-mst-13.2.git Test case from Karl Chen in RT #41831 (The bug was already fixed in blead, merged to maint, and it seems better to adapt the sample code rather than add the whole new test) p4raw-id: //depot/perl@30608 --- diff --git a/t/op/taint.t b/t/op/taint.t index 9dd155a..18b750f 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -17,7 +17,7 @@ use Config; use File::Spec::Functions; BEGIN { require './test.pl'; } -plan tests => 260; +plan tests => 261; $| = 1; @@ -1230,3 +1230,35 @@ SKIP: eval 'eval $tainted'; like ($@, qr/^Insecure dependency in eval/); } + +# This may bomb out with the alarm signal so keep it last +SKIP: { + skip "No alarm()" unless $Config{d_alarm}; + # Test from RT #41831] + # [PATCH] Bug & fix: hang when using study + taint mode (perl 5.6.1, 5.8.x) + + my $DATA = <<'END' . $TAINT; +line1 is here +line2 is here +line3 is here +line4 is here + +END + + #study $DATA; + + ## don't set $SIG{ALRM}, since we'd never get to a user-level handler as + ## perl is stuck in a regexp infinite loop! + + alarm(10); + + if ($DATA =~ /^line2.*line4/m) { + fail("Should not be a match") + } else { + pass("Match on tainted multiline data should fail promptly"); + } + + alarm(0); +} +__END__ +# Keep the previous test last