Skip Menu |

This queue is for tickets about the Archive-Tar CPAN distribution.

Report information
The Basics
Id: 17669
Status: resolved
Priority: 0/
Queue: Archive-Tar

People
Owner: Nobody in particular
Requestors: cpan.org [...] in-addr.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.28
Fixed in: (no value)



Subject: Corrupt tar file leads to a call to an undefined value
If a corrupt tar file is fed into Archive::Tar, it is possible for the unless loop starting at line 278 to exit without defining a valid $entry value. This leads to the module aborting prematurely at line 288 with: Can't call method "is_label" on an undefined value at .../Archive/Tar.pm line 288. As a hack/work around I've put the following on the line before: next if (!defined($entry)); However, there should be a cleaner solution. I don't fully understand whats going on in that bit of code, so my hack is probably ill-advised
On Wed Feb 15 23:24:16 2006, guest wrote: Show quoted text
> If a corrupt tar file is fed into Archive::Tar, it is possible for the > unless loop starting at line 278 to exit without defining a valid $entry > value. This leads to the module aborting prematurely at line 288 with: > > Can't call method "is_label" on an undefined value at .../Archive/Tar.pm > line 288.
Hmm, it actually shouldn't be able to..... the check is done in the code, in an unless statement... ### pass the realname, so we can set it 'proper' right away ### some of the heuristics are done on the name, so important ### to set it ASAP my $entry; { my %extra_args = (); $extra_args{'name'} = $$real_name if defined $real_name; unless( $entry = Archive::Tar::File->new( chunk => $chunk, %extra_args ) ) { $self->_error( qq[Couldn't read chunk at offset $offset] ); next; } } ### ignore labels: ### http://www.gnu.org/manual/tar/html_node/tar_139.html next if $entry->is_label; Do you have a bit of example code that somehow manages to get through this check anyway?
On Thu Mar 02 10:09:12 2006, KANE wrote: Show quoted text
> unless( $entry = Archive::Tar::File->new( chunk => $chunk, > %extra_args ) > ) { > $self->_error( qq[Couldn't read chunk at offset $offset] ); > next; > }
This actually required a 'next LOOP;' statement rather than just next; This has been fixed in 1.29 -- thank you for reporting