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

In ZipFile.GetOutputStream, ensure that any created crypto streams are disposed #452

Merged
merged 1 commit into from Aug 16, 2020

Conversation

Numpsy
Copy link
Contributor

@Numpsy Numpsy commented Apr 21, 2020

When looking at #443 I noticed that the encryption streams created in ZipFile.GetOutputStream didn't seem to be getting disposed.

In order to ensure that they are, I think we need to

  1. In the CompressionMethod.Deflated case, make the DeflaterOutputStream own the encryption stream, so that they get disposed together.

  2. In the CompressionMethod.Stored case, I think it should be safe to return the encryption stream directly in this case rather than creating an intermediate UncompressedStream? (The stream is only used internally so there should be minimum scope for unexpected uses of it).

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@Numpsy
Copy link
Contributor Author

Numpsy commented Apr 21, 2020

(443 contains a variant of this change, this is to break it out into it's own piece as it seems useful to have separately)

@Numpsy Numpsy added the zip Related to ZIP file format label May 3, 2020
@piksel piksel self-requested a review May 27, 2020 21:36
@piksel piksel merged commit 8eb94b1 into icsharpcode:master Aug 16, 2020
@Numpsy Numpsy deleted the rw/zipfile/dispose_crypto_stream branch August 16, 2020 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zip Related to ZIP file format
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants