Unknown header with some ZIP files #21

Open
opened 2026-01-29 22:03:36 +00:00 by claunia · 5 comments
Owner

Originally created by @ptallett on GitHub (Dec 26, 2014).

The following zip file throws an unknown header exception

http://downloadmirror.intel.com/24498/a08/gfx_7-8.1_15.36.0.4014_beta.zip

Cheers,
Paul

Originally created by @ptallett on GitHub (Dec 26, 2014). The following zip file throws an unknown header exception http://downloadmirror.intel.com/24498/a08/gfx_7-8.1_15.36.0.4014_beta.zip Cheers, Paul
Author
Owner

@larvata commented on GitHub (Dec 30, 2014):

I have decompressed this file successfully with following code

var testFile = @"E:\Temp\New folder\gfx_7-8.1_15.36.0.4014_beta.zip";
using (var reader = ReaderFactory.Open(File.OpenRead(testFile)))
{
    reader.WriteAllToDirectory("outDir",ExtractOptions.ExtractFullPath);
}

Can you give some details, e.g. sharpcompress version,callstack,your code for decompress

@larvata commented on GitHub (Dec 30, 2014): I have decompressed this file successfully with following code ``` var testFile = @"E:\Temp\New folder\gfx_7-8.1_15.36.0.4014_beta.zip"; using (var reader = ReaderFactory.Open(File.OpenRead(testFile))) { reader.WriteAllToDirectory("outDir",ExtractOptions.ExtractFullPath); } ``` Can you give some details, e.g. sharpcompress version,callstack,your code for decompress
Author
Owner

@ptallett commented on GitHub (Jan 10, 2015):

Sorry to be slow replying. I am using the Windows Store version of the library, not sure of the version, maybe 0.10.3.0?

            var archive = ArchiveFactory.Open(stream);

            using (var reader = archive.ExtractAllEntries())

            {

                while (reader.MoveToNextEntry())

                {

                    Debug.WriteLine(reader.Entry.Key);

                }

            }

Cheers,

Paul

From: Larvata [mailto:notifications@github.com]
Sent: 30 December 2014 01:49
To: adamhathcock/sharpcompress
Cc: ptallett
Subject: Re: [sharpcompress] Unknown header with some ZIP files (#33)

I have decompressed this file successfully with following code

var testFile = @"E:\Temp\New folder\gfx_7-8.1_15.36.0.4014_beta.zip";
using (var reader = ReaderFactory.Open(File.OpenRead(testFile)))
{
reader.WriteAllToDirectory("outDir",ExtractOptions.ExtractFullPath);
}

Can you give some details, e.g. sharpcompress version,callstack,your code for decompress


Reply to this email directly or view it on GitHub https://github.com/adamhathcock/sharpcompress/issues/33#issuecomment-68322950 . https://github.com/notifications/beacon/AJ1R_RDxBnevrQy9kIU79Q51kG7Q8F65ks5ncfvygaJpZM4DMabw.gif

@ptallett commented on GitHub (Jan 10, 2015): Sorry to be slow replying. I am using the Windows Store version of the library, not sure of the version, maybe 0.10.3.0? ``` var archive = ArchiveFactory.Open(stream); using (var reader = archive.ExtractAllEntries()) { while (reader.MoveToNextEntry()) { Debug.WriteLine(reader.Entry.Key); } } ``` Cheers, Paul From: Larvata [mailto:notifications@github.com] Sent: 30 December 2014 01:49 To: adamhathcock/sharpcompress Cc: ptallett Subject: Re: [sharpcompress] Unknown header with some ZIP files (#33) I have decompressed this file successfully with following code var testFile = @"E:\Temp\New folder\gfx_7-8.1_15.36.0.4014_beta.zip"; using (var reader = ReaderFactory.Open(File.OpenRead(testFile))) { reader.WriteAllToDirectory("outDir",ExtractOptions.ExtractFullPath); } Can you give some details, e.g. sharpcompress version,callstack,your code for decompress — Reply to this email directly or view it on GitHub https://github.com/adamhathcock/sharpcompress/issues/33#issuecomment-68322950 . https://github.com/notifications/beacon/AJ1R_RDxBnevrQy9kIU79Q51kG7Q8F65ks5ncfvygaJpZM4DMabw.gif
Author
Owner

@Guspaz commented on GitHub (Nov 24, 2017):

FYI, I encountered this same bug trying to extract an XML file from a DOCX file (they're ZIP files). Both the XML file and the DOCX file were just a few kilobytes and there are only a handful of files in the DOCX. NuGet package version was 0.18.2 in a .NET Core 2.0 project.

The issue triggered trying to do OpenEntryStream on a ZipArchive entry. I was trying to read the main content xml file in the document. I was able to work around the problem by using ZipReader instead of ZipArchive: I just had to iterate through the entries to find the file I wanted instead of being able to use linq to search for a filename like you can with ZipArchive.

If it matters, the DOCX file was generated by Google Drive from a Google Doc. Not all DOCX from Google fail, I was trying to open the second document in a folder when it happened.

@Guspaz commented on GitHub (Nov 24, 2017): FYI, I encountered this same bug trying to extract an XML file from a DOCX file (they're ZIP files). Both the XML file and the DOCX file were just a few kilobytes and there are only a handful of files in the DOCX. NuGet package version was 0.18.2 in a .NET Core 2.0 project. The issue triggered trying to do OpenEntryStream on a ZipArchive entry. I was trying to read the main content xml file in the document. I was able to work around the problem by using ZipReader instead of ZipArchive: I just had to iterate through the entries to find the file I wanted instead of being able to use linq to search for a filename like you can with ZipArchive. If it matters, the DOCX file was generated by Google Drive from a Google Doc. Not all DOCX from Google fail, I was trying to open the second document in a folder when it happened.
Author
Owner

@Messulethe92 commented on GitHub (Feb 28, 2018):

I got to this same issue, with nuget package reference to v0.18.2 in .NET Core project.

I am using the ZipReader.Open. Exception gets thrown on reader.MoveToNextEntry method. Zip only has one file in it.

Only way to get it working was by switching to the SharpCompress.Readers.ReaderFactory, which is not throwing the exception.

@Messulethe92 commented on GitHub (Feb 28, 2018): I got to this same issue, with nuget package reference to v0.18.2 in .NET Core project. I am using the ZipReader.Open. Exception gets thrown on reader.MoveToNextEntry method. Zip only has one file in it. Only way to get it working was by switching to the SharpCompress.Readers.ReaderFactory, which is not throwing the exception.
Author
Owner

@Messulethe92 commented on GitHub (Feb 28, 2018):

On further inspection, the exception occurs on the MoveToNextEntry method of either ZipReader or ReaderFactory. But what's interesting is that the way I'm iterating through the zip is through a While(zipReader.MoveToNextEntry()) loop. But when all the Entries are read, if the MoveToNextEntry method is called again, that's when the exception happens.

I would expect the MoveToNextEntry method to return a False instead of throwing an exception if there are no files left in the ZIP.

@Messulethe92 commented on GitHub (Feb 28, 2018): On further inspection, the exception occurs on the MoveToNextEntry method of either ZipReader or ReaderFactory. But what's interesting is that the way I'm iterating through the zip is through a While(zipReader.MoveToNextEntry()) loop. But when all the Entries are read, if the MoveToNextEntry method is called again, that's when the exception happens. I would expect the MoveToNextEntry method to return a False instead of throwing an exception if there are no files left in the ZIP.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#21