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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 23 20:08:17 PST 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 at digitalmars.com
        ReportedBy: davidl at 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);
        ....


-- 




More information about the Digitalmars-d-bugs mailing list