digitalmars.D.bugs - [Issue 18452] New: std.zip has size limit of 2 GB
- d-bugmail puremagic.com (52/52) Feb 16 2018 https://issues.dlang.org/show_bug.cgi?id=18452
https://issues.dlang.org/show_bug.cgi?id=18452 Issue ID: 18452 Summary: std.zip has size limit of 2 GB Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: andre s-e-a-p.de I just noticed that std.zip will throw an exception if the source files exceeds 2 GB. It seems an issue with std.zip as zlib has a limit of 4 GB. Windows 10 with x86_64 architecture. core.exception.RangeError std\zip.d(808): Range violation ---------------- 0x00007FF7C9B1705C in d_arrayboundsp 0x00007FF7C9B301FF in safe void std.zip.ZipArchive.putUshort(int, ushort) 0x00007FF7C9B2E634 in void[] std.zip.ZipArchive.build() void zipFolder(string archiveFilePath, string folderPath) { import std.zip, std.file; ZipArchive zip = new ZipArchive(); string folderName = folderPath.baseName; foreach(entry; dirEntries(folderPath, SpanMode.depth)) { if (!entry.isFile) continue; ArchiveMember am = new ArchiveMember(); am.name = entry.name[folderPath.length + 1..$]; am.expandedData(cast(ubyte[]) read(entry.name)); zip.addMember(am); } void[] compressed_data = zip.build(); // zip.build() will throw write(archiveFilePath, compressed_data); } Comment from Steven Schveighoffer: ...And you are right. I looked into it a bit, this has nothing to do (superficially) with zlib, it has to do with std.zip: https://github.com/dlang/phobos/blob/0107a6ee09072bda9e486a12caa148dc7af7bb08/std/zip.d#L806 Really, i should be size_t in all places, I can't see why it should ever be int. -- And Stefan Koch: ...It was partially changed in this PR: https://github.com/dlang/phobos/pull/2914/files The the put methods where left at int must have been an oversight. -- https://forum.dlang.org/post/pkhmlemvrpkroiqhugmw forum.dlang.org --
Feb 16 2018