Subject: | ZLib::Compress 1.34 - print uncompress($f) - gives segfault. |
This is the negative test case.
Please see the attached file to reproduce the error
This is happening at this last line in the file print uncompress($f), where $f is a file handle.
use IO::File ;
use Compress::Zlib ;
my $filename = "rw.zip" ;
sub ok
{
my ($no, $ok) = @_ ;
print "ok $no\n" if $ok ;
print "not ok $no\n" unless $ok ;
}
BEGIN{
unlink "rw.gz";
}
my $len=length (my $hello = "hello world\nthis is a test\n");
#create a test file
my $f = new IO::File ">$filename" ;
binmode $f ; # for OS/2
print $f $hello;
ok(3, my $fil = gzopen($f, "wb")) ;
ok(4, $fil->gzwrite($hello) == $len) ;
ok(5, ! $fil->gzclose ) ;
$f1 = new IO::File ">>$filename" ;
binmode $f1 ; # for OS/2
$i=0;
$tempString="String to write\n";
print $f1 compress($tempString),print STDOUT uncompress(compress($tempString)), $i++ while($i++<=1000);
ok(6, ! $fil->gzclose ) ;
print uncompress($f);