Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Conversation

@Anlo2846
Copy link

@Anlo2846 Anlo2846 commented Nov 4, 2023

When reading a zip archive embedded in another file, we get a BadReadException: "Bad signature at position [...]".
This is due to a bug in OffsetStream.Seek().
_originalPosition should only be added to the offset when origin == SeekOrigin.Begin.

Ionic.Zip.ZipException
  HResult=0x80131500
  Message=Cannot read that as a ZipFile
  Source=DotNetZip
  StackTrace:
   at Ionic.Zip.ZipFile.ReadIntoInstance(ZipFile zf) in DotNetZip.Semverd\src\Zip.Shared\ZipFile.Read.cs:line 660
   at Ionic.Zip.ZipFile.Read(Stream zipStream, TextWriter statusMessageWriter, Encoding encoding, EventHandler`1 readProgress) in DotNetZip.Semverd\src\Zip.Shared\ZipFile.Read.cs:line 543
   at Ionic.Zip.ZipFile.Read(Stream zipStream) in DotNetZip.Semverd\src\Zip.Shared\ZipFile.Read.cs:line 414
   at Ionic.Zip.Tests.Streams.StreamsTests.ReadZip_WithOffset() in DotNetZip.Semverd\src\Zip Tests\Streams.cs:line 225

  This exception was originally thrown at this call stack:
    Ionic.Zip.ZipFile.ReadCentralDirectoryFooter(Ionic.Zip.ZipFile) in ZipFile.Read.cs
    Ionic.Zip.ZipFile.ReadCentralDirectory(Ionic.Zip.ZipFile) in ZipFile.Read.cs
    Ionic.Zip.ZipFile.ReadIntoInstance(Ionic.Zip.ZipFile) in ZipFile.Read.cs

Inner Exception 1:
BadReadException: Bad signature (0000002C) at position 0x00000082
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant