Open AbhishekTripathi opened 4 years ago
@AbhishekTripathi thanks for reporting. Do you have the callstack where the loop happens?
I may have to debug the nuget source but the function never returns. Seems it gets stuck in infinite loop.
Any update on the fix/alternative workaround for this issue?
Can you share callstack @graviteja94 ?
Hi @danmoseley Could you see the attached screenshot?
upon executing the using statement, for a corrupted zip it never goes to the next line and the call stack is also empty
basically my code keeps running indefinitely without throwing any exception.
I'm not sure if I provided the information you requested, can you point me out on how to collect the call stack?
Hi @graviteja94 I meant, break in at the point of the hang and get a stack. but if the hang is just looping in your code, of course that's not useful.
I'll let the area owners for compression speak to the issue as it's not my area
I'm currently attempting to read a corrupt zip file. When manually testing the archive file by 7-Zip, it's identified with an Unexpected end of data
and has a Data error
for only one of its many files. When attempting to access this zip file via ZipArchive, I'm observing an infinite loop at the following location:
https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.Compression/src/System/IO/Compression/ZipHelper.cs#L119-L139
with callstack
> System.IO.Compression.dll!System.IO.Compression.ZipHelper.SeekBackwardsToSignature(System.IO.Stream stream, uint signatureToFind) Line 89 C#
System.IO.Compression.dll!System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory() Line 390 C#
System.IO.Compression.dll!System.IO.Compression.ZipArchive.Init(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen) Line 340 C#
System.IO.Compression.dll!System.IO.Compression.ZipArchive.ZipArchive(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode) Line 100 C#
I hope this helps.
@jzirkelbach thanks, that does help. Any interest in investigating ?
@danmoseley, I'm getting more involved with compression work, but I don't have the availability to reliably commit time. I'll continue to watch this issue and contribute when and where I can.
I have found that the
ZipArchive
goes in an infinite loop when a zip stream is provided from Azure Storage. Below is a code snippet which is easy to reproduce by using any arbitrary file and renaming to zip or using a corrupt zip itself. Using System.IO.Compression v4.3.0. Note that when the files exist on local disk, the behavior is as expected and I get proper exception.