Some zip files have incorrect file size calculations #364

Open
opened 2026-01-29 22:10:43 +00:00 by claunia · 7 comments
Owner

Originally created by @zhusheping on GitHub (Aug 12, 2019).

which lead to the file size soaring after decompression.
I don't want test files published in public space. I can't find your email. If you email me, I will attach it to the reply.

Originally created by @zhusheping on GitHub (Aug 12, 2019). which lead to the file size soaring after decompression. I don't want test files published in public space. I can't find your email. If you email me, I will attach it to the reply.
claunia added the bug label 2026-01-29 22:10:43 +00:00
Author
Owner

@adamhathcock commented on GitHub (Aug 12, 2019):

Is this a flaw in other implementations too or specific to SharpCompress?

@adamhathcock commented on GitHub (Aug 12, 2019): Is this a flaw in other implementations too or specific to SharpCompress?
Author
Owner

@zhusheping commented on GitHub (Aug 13, 2019):

I's specific to SharpCompress.
And now,in my project,i use System.IO.Compression for zip file and sharpcompress for rar.
I've also tried DotNetZip,SevenZip,and they are all ok.but dotnetzip just support zip,and i don't like using sevenzip's method of referencing DLL libraries.

I guess it's a bug for sharpcompress.

Attached is a private document, please do not disseminate it.Thanks a lot.

Is this a flaw in other implementations too or specific to SharpCompress?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

从QQ邮箱发来的超大附件

23261-01b-1555762529053.zip (133.70M, 2019年09月12日 08:49 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?t=exs_ftn_download&k=36376363a6f19d96a4266f6345350b4e5f03520107040b034b05075b50180d0456004e5b53515a4c5556545302540d545e0f5006632e3953550555524e0508034b06565656020f5353055a535606171b0f47635e&code=f7ccc59a

@zhusheping commented on GitHub (Aug 13, 2019): I's specific to SharpCompress. And now,in my project,i use System.IO.Compression for zip file and sharpcompress for rar. I've also tried DotNetZip,SevenZip,and they are all ok.but dotnetzip just support zip,and i don't like using sevenzip's method of referencing DLL libraries. I guess it's a bug for sharpcompress. Attached is a private document, please do not disseminate it.Thanks a lot. ------------------ Is this a flaw in other implementations too or specific to SharpCompress? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread. 从QQ邮箱发来的超大附件 23261-01b-1555762529053.zip (133.70M, 2019年09月12日 08:49 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?t=exs_ftn_download&k=36376363a6f19d96a4266f6345350b4e5f03520107040b034b05075b50180d0456004e5b53515a4c5556545302540d545e0f5006632e3953550555524e0508034b06565656020f5353055a535606171b0f47635e&code=f7ccc59a
Author
Owner

@adamhathcock commented on GitHub (Aug 20, 2019):

If you could debug this with your file and submit a pull request, that would be great

@adamhathcock commented on GitHub (Aug 20, 2019): If you could debug this with your file and submit a pull request, that would be great
Author
Owner

@zhusheping commented on GitHub (Aug 21, 2019):

The entry size is correct until which line of debugging is executed.
I don't know why it keep files with another size.
Additional, when "var entryStream = archiveEntry.OpenEntryStream();" executed, archiveEntry.Size and archiveEntry.CompressedSize All become zero.

image

If you could debug this with your file and submit a pull request, that would be great


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@zhusheping commented on GitHub (Aug 21, 2019): The entry size is correct until which line of debugging is executed. I don't know why it keep files with another size. Additional, when "var entryStream = archiveEntry.OpenEntryStream();" executed, archiveEntry.Size and archiveEntry.CompressedSize All become zero. ![image](https://user-images.githubusercontent.com/23443907/63424265-a1063380-c440-11e9-8b13-6a3090b4015b.png) If you could debug this with your file and submit a pull request, that would be great — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Author
Owner

@adamhathcock commented on GitHub (Aug 21, 2019):

can you attach a code snippet and maybe some comments where it's going wrong?

@adamhathcock commented on GitHub (Aug 21, 2019): can you attach a code snippet and maybe some comments where it's going wrong?
Author
Owner

@zhusheping commented on GitHub (Aug 22, 2019):

I guess the problem is in line 25 of the SharpCompress. Archives. IArchiveEntry Extensions. CS file. When 24 lines are executed, archiveEntry. Size and archiveEntry. CompressedSize are correct. When 25 lines are executed, archiveEntry. Size and archiveEntry. CompressedSize become zero.
24: streamListener.FireFilePartExtractionBegin(archiveEntry.Key, archiveEntry.Size, archiveEntry.CompressedSize);
25: var entryStream = archiveEntry.OpenEntryStream();
Since the data is miscalculated, the part written to the file after 25 line is naturally wrong.

@zhusheping commented on GitHub (Aug 22, 2019): I guess the problem is in line 25 of the SharpCompress. Archives. IArchiveEntry Extensions. CS file. When 24 lines are executed, archiveEntry. Size and archiveEntry. CompressedSize are correct. When 25 lines are executed, archiveEntry. Size and archiveEntry. CompressedSize become zero. 24: streamListener.FireFilePartExtractionBegin(archiveEntry.Key, archiveEntry.Size, archiveEntry.CompressedSize); 25: var entryStream = archiveEntry.OpenEntryStream(); Since the data is miscalculated, the part written to the file after 25 line is naturally wrong.
Author
Owner

@adamhathcock commented on GitHub (Aug 30, 2019):

Looks like the entry values should be cached somehow instead of dynamically calculated. Opening the entry stream is probably the cause since the data stream advances.

@adamhathcock commented on GitHub (Aug 30, 2019): Looks like the entry values should be cached somehow instead of dynamically calculated. Opening the entry stream is probably the cause since the data stream advances.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#364