mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Decompression via ZlibStream for large message doesn't work #477
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DmitryLukyanov on GitHub (Sep 20, 2021).
The below test triggers the following exception in
Decompressstep for a message bigger than 131072 letters on latest nuget versions. Messages with length less or equal to 131072 letters are decompressed fine. I've checked '0.29.0', '0.28.0', '0.27.0':but it works fine for versions <=
0.26.0@SymbioticKilla commented on GitHub (Oct 11, 2021):
Is there any ETA? We use MongoDB Driver that uses this library and there is a vulnerability shown in the reports => it is PITA for the companies which have strict compliance rules. MongoDB can not update it because of this bug.
Thanks!
@adamhathcock commented on GitHub (Oct 11, 2021):
The "vulnerability" is when the file pathing code is being used. Would the driver be using that?
I don't have an ETA on this because I'm not actually working on it and there is no PR to merge.
At a guess, iit must be something in the 0.27 release that is causing it: https://github.com/adamhathcock/sharpcompress/releases/tag/0.27
I'd put that test in and start reverting/testing the changes from the 0.27 and see what happens.
@SymbioticKilla commented on GitHub (Nov 8, 2021):
Any update?
@adamhathcock commented on GitHub (Nov 9, 2021):
Sorry no. I need help
@DmitryLukyanov commented on GitHub (Nov 22, 2021):
First broken commit.
The solution (at least to fix the above test) is reverting this line (and related nested class). Hopefully this will help.
@AraHaan commented on GitHub (Nov 22, 2021):
I actually started with my own zlib by actually using the native version for compression using C# 10 features.
This pull request which I plan to merge soon that replaces the stream with a public static class that uses spans.
@DmitryLukyanov commented on GitHub (Nov 22, 2021):
In more details, the above test works without this condition that repeatedly returns
1(SeedValue) instead of repeatedly2957970271@adamhathcock commented on GitHub (Nov 22, 2021):
I've made a PR with the test and identified fix: https://github.com/adamhathcock/sharpcompress/pull/624
Eyeball it and I'll merge it and push to nuget
@adamhathcock commented on GitHub (Nov 22, 2021):
If you're interested in porting your zlib into here and possibly helping reworking other algorithms to be Span/Async, let me know. I started a branch months ago but time got away from me again. My blocker was my lack of knowledge of the algorithms so doing span/async on them broke and I could not figure why
@adamhathcock commented on GitHub (Nov 22, 2021):
Should be on nuget soon https://www.nuget.org/packages/SharpCompress/0.30.1
@AraHaan commented on GitHub (Nov 22, 2021):
Also there is another issue as well too on providing a zlib library file for the following RIDs:
Currently on linux it uses the system provided zlib (which I do not know if it's 1.2.11 for all linux installs and I do hardcode it to version 1.2.11 with a way to tell it to use a different version), For MacOS there is a system provided zlib but I do not know where to locate it so I expect them to install it with homebrew currently. As for Windows, I have no clue what to do and currently expect them to basically compile zlib themselves.
The only thing I can think of is to somehow on whatever OS is used to compile to somehow cross compile zlib to all of those RIDs and then package them as native dependencies on the nuget package.
Alternatively I could look into if I can change my code slightly to use the built in clrcompression library and then not worry about zlib no more but it involves looking at the code to that library that is built into the .NET default runtime.
@DmitryLukyanov commented on GitHub (Nov 22, 2021):
it works for us, closing this issue then