Thread overview
[Issue 592] New: expand in std.zip reassign values to archievemember's members prevent from correctly unzip some zip files
Nov 24, 2006
d-bugmail
Nov 24, 2006
d-bugmail
Nov 30, 2006
d-bugmail
Feb 13, 2007
d-bugmail
Feb 15, 2007
d-bugmail
November 24, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=592

           Summary: expand in std.zip reassign values to archievemember's
                    members prevent from correctly unzip some zip files
           Product: D
           Version: 0.174
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: davidl@126.com


i think we should trust the end block's info of the zip file

correct code should be like the following. std.zip Archieve expand member function:

    ubyte[] expand(ArchiveMember de)
    {   uint namelen;
        uint extralen;

        if (data[de.offset .. de.offset + 4] != cast(ubyte[])"PK\x03\x04")
            throw new ZipException("invalid directory entry 4");

        // These values should match what is in the main zip archive directory
        /*
        de.extractVersion = getUshort(de.offset + 4);
        de.flags = getUshort(de.offset + 6);
        de.compressionMethod = getUshort(de.offset + 8);
        de.time = cast(DosFileTime)getUint(de.offset + 10);
        de.crc32 = getUint(de.offset + 14);
        de.compressedSize = getUint(de.offset + 18);
        de.expandedSize = getUint(de.offset + 22);
        */
        //TODO: shall we consider the following to be namelen = de.name.length?
        namelen = getUshort(de.offset + 26);
        //TODO: shall we consider the following to be extralen =
de.comment.length?
        extralen = getUshort(de.offset + 28);
        ....


-- 

November 24, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=592





------- Comment #1 from davidl@126.com  2006-11-23 22:09 -------
Created an attachment (id=81)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=81&action=view)
patch for the std.zip


-- 

November 30, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=592





------- Comment #2 from bugzilla@digitalmars.com  2006-11-30 02:11 -------
Is there a historical/technical reason why one should be preferred over the other?


-- 

February 13, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=592


davidl@126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1
            Version|0.174                       |1.005




------- Comment #3 from davidl@126.com  2007-02-12 21:14 -------
err, the problem is newly patched std.zip could unzip all zip files, the original one couldn't unzip all those files.


namelen = de.name.length extralen = de.comment.length

those two lengths are always correct not the one we have in our std.zip now


-- 

February 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=592


braddr@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2
            Version|1.005                       |0.174




--