Patches item #1546132, was opened at 2006-08-24 17:36
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1546132&group_id=51305

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David Hart (dghart)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxArchive fails with some malformed archives

Initial Comment:
Hi Mike,

I've found a problem with wxArchive tarstrm.cpp. It
happens with tar archives that were downloaded as
tar.bz2 files, and decompressed either with bunzip2 or
with Ryan Norton's wxBZipStream class. About half of
these are currently not readable: they give a "checksum
failure reading tar header block" message.

The problem is that in these archives, the TypeFlag
field for regular files is blank, rather than holding
'0'. As a result m_TypeFlag holds '\0', and this is
matched in the strchr(ignore,...) call in
GetDataSize(). So all files are assumed to have zero
size.  This means the next header is not found
correctly; thus the error message.

I could have translated each blank into '0', but I
don't know what the buggy version of tar will do to
pipes etc (none of the broken archives had such
rarities). So I've made the lesser change of checking
in GetDataSize() for a null m_TypeFlag, and assuming
this to be a regular file. All the tar.bz2 files that
I've tried can now be untarred successfully.

The good news is that tarstreams  work well in
conjunction with both wxZlibInputStream (for .tgz) and
(the patched) wxBZipStream, in a real-life situation:
'peeking' into archives in a (linux) filemanager.
Thanks for creating them, and I hope tarstreams and
wxBZipStream are added soon to the wxWidgets, er,
mainstream.

I've sent a similar report to Chris Elliott at wxHatch.

Regards,

David Hart


--- tarstrm.cpp 2006-08-24 17:56:50.000000000 +0100
+++ tarstrm.cpp 2006-08-24 17:57:01.000000000 +0100
@@ -350,4 +350,6 @@
 static inline wxFileOffset GetDataSize(const
wxTarEntry& entry)
 {
+    if ( entry.GetTypeFlag() == '\0' ) return
entry.GetSize();  // First check there *is* a file
type: some archives seem to omit it for regular files
+
     const char ignore[] = {
         wxTAR_CHRTYPE, wxTAR_BLKTYPE, wxTAR_DIRTYPE,
wxTAR_FIFOTYPE, 0




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1546132&group_id=51305

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to