Bug 592 – expand in std.zip: reassigning values to ArchiveMember's members prevents correct unzipping of some zip files

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2006-11-23T22:08:00Z
Last change time
2015-11-03T17:38:06Z
Keywords
patch
Assigned to
bugzilla
Creator
davidl

Attachments

IDFilenameSummaryContent-TypeSize
81patchpatch for the std.ziptext/plain198

Comments

Comment #0 by davidl — 2006-11-23T22:08:16Z
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); ....
Comment #1 by davidl — 2006-11-23T22:09:23Z
Created attachment 81 patch for the std.zip
Comment #2 by bugzilla — 2006-11-30T02:11:30Z
Is there a historical/technical reason why one should be preferred over the other?
Comment #3 by davidl — 2007-02-12T21:14:33Z
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
Comment #4 by andrei — 2015-11-03T17:38:06Z
It's unlikely this D1 issue will get worked on, if anyone plans to work on it feel free to reopen.