www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 592] New: expand in std.zip reassign values to archievemember's members prevent from correctly unzip some zip files

reply d-bugmail puremagic.com writes:
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);
        ....


-- 
Nov 23 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=592






Created an attachment (id=81)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=81&action=view)
patch for the std.zip


-- 
Nov 23 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=592






Is there a historical/technical reason why one should be preferred over the
other?


-- 
Nov 30 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
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





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


-- 
Feb 12 2007
prev sibling parent d-bugmail puremagic.com writes:
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




-- 
Feb 15 2007