Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.NotSupportedException when zipping more than ~4.2 gb of data to a stream that doesn't support seeking #164

Closed
1 of 8 tasks
zlangner opened this issue Jan 19, 2017 · 1 comment

Comments

@zlangner
Copy link

Steps to reproduce

You have to zip up enough data so that when the stream is writing the end of the central directory the function ZipHelperStream.WriteZip64EndOfCentralDirectory will be called. The first thing this does is call stream_.Position which immediately fails if the stream being written to doesn't support seeking and therefore doesn't support position. MSDN describes the relationship between the stream position property and the CanSeek property.

Expected behavior

Ideally, the stream's position would not be needed at all. Instead I think this should be tracked like the sizeEntries or startOfCentralDirectory is already being tracked by SharpZipLib.

Actual behavior

Since the underlying stream does not support seeking the stream's position property throws a System.NotSupportedException which then bubbles up.

Version of SharpZipLib

0.86.0.518

Obtained from (place an x between the brackets for all that apply)

  • Compiled from source
  • branch: _______
  • commit: _______
  • Downloaded DLL from GitHub
  • Downloaded DLL from SourceForge
  • Downloaded DLL from _______
  • DLL included as part of
  • Package installed using:
  • NuGet
  • MyGet
  • Chocolatey
@zlangner zlangner changed the title System.NotSupportedException when zipping more than ~4.2 gb of data to a stream doesn't support seeking System.NotSupportedException when zipping more than ~4.2 gb of data to a stream that doesn't support seeking Jan 19, 2017
@insylogo
Copy link
Contributor

Here's a PR that addresses this issue: #226

piksel added a commit that referenced this issue Jul 12, 2018
Fixes issue #164 by not accessing stream position to determine central
signature offset (instead, use central directory offset + size of all entries)
@piksel piksel closed this as completed Jul 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants