Extraction of password-protected Zip files failed.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the issue with a password-protected Zip created by Bandizip and follow the extraction loop shown in the report, especially the read after the ZipEntry is fully consumed. Done means extracting the entry succeeds and a subsequent read returns 0 instead of throwing “Data descriptor signature not found”.
Written by the indexing model from the issue text.
Description
Describe the bug
When other programs (such as Bandizip) compress files into password-protected Zip files, using this library to extract them will throw an exception.
When the 'ZipEntry' is fully read, an exception will be thrown on the next read attempt.
ICSharpCode.SharpZipLib.Zip.ZipException: Data descriptor signature not found
`
// An exception will be thrown here.
while ((ze = zis.GetNextEntry()) != null) {
string filePath = Path.Combine(targetFolderPath, ze.Name);
string directoryPath = Path.GetDirectoryName(filePath) ?? string.Empty;
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath)) {
Directory.CreateDirectory(directoryPath);
}
if (File.Exists(filePath)) {
File.Delete(filePath);
}
if (!ze.IsDirectory) {
long nCur = 0;
long nLength = zis.Length;
OnUnZipEntryStart(ze.Name);
OnUnZipEntryProgress(0, nLength);
using (FileStream fs = File.Create(filePath)) {
int sourceBytes;
do {
//An exception will be thrown here.
sourceBytes = zis.Read(data, 0, data.Length);
nCur += sourceBytes;
fs.Write(data, 0, sourceBytes);
} while (sourceBytes > 0);
}
}
}
`
Reproduction Code
No response
Steps to reproduce
When the 'ZipEntry' is fully read
On subsequent reads, it is theoretically expected to return 0.
But throw ICSharpCode.SharpZipLib.Zip.ZipException: Data descriptor signature not found
Expected behavior
None
Operating System
Windows
Framework Version
.NET Framework 4.x
Tags
No response
Additional context
No response
- Dominant language
- C#
- Stars
- 3.9k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from icsharpcode/SharpZipLib
-
*no response* bug
Difficulty 1/5 Under an hour Newbie friendliness 78/100
icsharpcode/SharpZipLib#905 · 1 comment ·
-
bug bzip2
Difficulty 4/5 3-5 days Newbie friendliness 45/100
icsharpcode/SharpZipLib#904 ·
-
SetLevel in ZipFile Openenhancement zip
Difficulty 2/5 1-2 days Newbie friendliness 55/100
icsharpcode/SharpZipLib#903 ·
-
*no response* bug
Difficulty 4/5 3-5 days Newbie friendliness 32/100
icsharpcode/SharpZipLib#901 · 1 comment ·
-
*no response* enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
icsharpcode/SharpZipLib#893 ·
All issues in icsharpcode/SharpZipLib
Similar issues
-
priority-0
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
StackExchange/StackExchange.Redis#3249 ·
-
[Feat] 조합 영역 구분선 개선 Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100