develooper Front page | perl.perl5.porters | Postings from March 2006

Uninitialized value in Archive::Tar

Thread Next
From:
Randy W. Sims
Date:
March 20, 2006 03:38
Subject:
Uninitialized value in Archive::Tar
Message ID:
441E93FB.3050906@thepierianspring.org

In the _read_tar method of Archive::Tar, it calls 
Archive::Tar::File->new with a "chunk" which in turn calls its 
_new_from_chunk method. This method doesn't define its 'data' member, so 
later when it's referenced

   $data = $entry->get_content_by_ref;
   ...
   substr ($$data, $entry->size) = "";

we get an error calling substr on an undef value.

The attached patch provides a very localised fix for the problem, but I 
don't know the code well enough to say that it is the correct fix. It 
does eliminate the warnings and all tests pass.

Randy.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About