-
Notifications
You must be signed in to change notification settings - Fork 18
Allow to create LZ4BlockInputStream with LZ4SafeDecompressor #3
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
Allow to create LZ4BlockInputStream with LZ4SafeDecompressor #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully these comments are useful. Note that I am not a project member, so feel free to consider my comments only as suggestions.
1d41aae to
51de1cd
Compare
|
How urgent is this change for you? I was going to wait with the next minor release (1.10) until the unsafe implementations are tested enough to be re-enabled, but that may take a few more weeks since I'm very busy atm and also have vacations coming up. If this change is important, I can get 1.10 out earlier for this change and wait with the unsafe stuff for 1.11. |
|
We'd really appreciate this being merged soon if possible. Currently we were using LZ4Factory.nativeInstance() and fastCompressor and fastDecompressor methods. And the results made me very nervous at first.
However, it turns out safeDecompressor (still using LZ4Factory.nativeInstance) is indeed faster than fastDecompressor and did seem to restore performance to an acceptable level
So this covers the direct factory methods, but still leaves open the block input stream as this issue mentions, and which we do use in our code. |
51de1cd to
1dd9c2d
Compare
|
Okay, then I will get out a release with this before I leave for vacation. Also: Please avoid force pushing in the future. It makes changes harder to review incrementally. You can also apply changes from the GitHub UI in individual commits rather than manually. When I merge this, I will squash all changes into a single commit anyway. |
- added builder for LZ4BlockInputStream which accepts both fast and safe decompressor (prefers fast one)
1dd9c2d to
5d8a820
Compare
|
Thank you so much for your time and effort! We will be waiting for the changes to be released. |
|
Thanks for the contribution! I will make some more changes and then release 1.10 shortly. |
|
@meshcow v1.10.0 is out now, I can already see it on central. |
|
|
Should (Sharing the same decompressor for multiple Sorry, I just noticed this now. |
|
Yea I guess now that the InputStream is passed to the build method, there's nothing preventing you from reusing the builder… I'll add a comment |
### What changes were proposed in this pull request? This PR aims to upgrade `lz4-java` to 1.10.0 and exclude the legacy groupID version. ### Why are the changes needed? Since `lz4-java` changed its repository, we had better depend on the live repository for future maintenance. - https://github.com/lz4/lz4-java (Archived with the last release on 2021-06-19) - https://github.com/lz4/lz4-java/releases/tag/1.8.0 (2021-06-19) - https://github.com/yawkat/lz4-java (New Fork) - https://github.com/yawkat/lz4-java/releases/tag/v1.9.0 - Update lz4 to v1.10.0 - https://github.com/yawkat/lz4-java/releases/tag/v1.10.0 - yawkat/lz4-java#3 ### Does this PR introduce _any_ user-facing change? No Spark behavior change. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53327 from dongjoon-hyun/SPARK-54597. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Motivation
In workarounds section of CVE-2025-12183 it is suggested in long run to use safe decompressor instead of vulnerable fast one. Also, authors of the original Java Lz4 code outlined in javadoc that native fast decompressor is SLOWER than safe one.
The LZ4BlockInputStream accepts fast decompressor only at the moment.
Change
Added builder for LZ4BlockInputStream which accepts both fast and safe decompressor (prefers fast one).