-
Notifications
You must be signed in to change notification settings - Fork 18
Add test for corrupted LZ4 block input stream #7
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
Add test for corrupted LZ4 block input stream #7
Conversation
e508bad to
043c458
Compare
| // Don't create Builder here, otherwise the same Builder instance would be used for all tests, and the | ||
| // tests would interfere with each other due to the modifications to the builder | ||
| { (Consumer<LZ4BlockInputStream.Builder>) builder -> builder.withDecompressor(LZ4Factory.fastestInstance().fastDecompressor()) }, | ||
| { (Consumer<LZ4BlockInputStream.Builder>) builder -> builder.withDecompressor(LZ4Factory.fastestInstance().safeDecompressor()) } |
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.
Changed this because the previous implementation was quite error-prone: It looks like all test methods in this class used the same LZ4BlockStreamingTest instance, and therefore also the same preInitializedBuilder. Therefore tests could affect each other if they forgot to overwrite / reset all builder configurations.
This happened to me while adding this new test, and due to the usage of randomizedtesting it made the resulting test failures even non-deterministic (unless you reran with the same seed I guess?).
An alternative might be to configure this test to create a new LZ4BlockStreamingTest per test method / test execution (in case that is possible).
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.
with junit 5 we could use @TestInstance for this… but i guess this approach is more clear, and also allows tests to create multiple streams in one test call
|
LGTM |
Bumps [at.yawk.lz4:lz4-java](https://github.com/yawkat/lz4-java) from 1.10.0 to 1.10.1. Release notes *Sourced from [at.yawk.lz4:lz4-java's releases](https://github.com/yawkat/lz4-java/releases).* > lz4-java v1.10.1 > ---------------- > > Contains fix for [CVE-2025-66566](GHSA-cmp6-m4wj-q63q)! > > What's Changed > -------------- > > * Add test for corrupted LZ4 block input stream by [`@Marcono1234`](https://github.com/Marcono1234) in [yawkat/lz4-java#7](https://redirect.github.com/yawkat/lz4-java/pull/7) > * Update documentation for checksum registration by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#8](https://redirect.github.com/yawkat/lz4-java/pull/8) > * Migrate to maven-git-versioning-extension by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#10](https://redirect.github.com/yawkat/lz4-java/pull/10) > * Add workflow\_dispatch trigger to multi-platform build to allow testing without release by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#13](https://redirect.github.com/yawkat/lz4-java/pull/13) > * Copy native libraries to target/classes instead of src/resources by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#14](https://redirect.github.com/yawkat/lz4-java/pull/14) > > **Full Changelog**: <yawkat/lz4-java@v1.10.0...v1.10.1> Commits * [`33d180c`](yawkat/lz4-java@33d180c) Merge commit from fork * [`da95a00`](yawkat/lz4-java@da95a00) Copy native libraries to target/classes instead of src/resources ([#14](https://redirect.github.com/yawkat/lz4-java/issues/14)) * [`1e9bf8c`](yawkat/lz4-java@1e9bf8c) Add workflow\_dispatch trigger to multi-platform build to allow testing withou... * [`89c02be`](yawkat/lz4-java@89c02be) Migrate to maven-git-versioning-extension ([#10](https://redirect.github.com/yawkat/lz4-java/issues/10)) * [`d948832`](yawkat/lz4-java@d948832) Update documentation for checksum registration ([#8](https://redirect.github.com/yawkat/lz4-java/issues/8)) * [`02bbbf0`](yawkat/lz4-java@02bbbf0) Add test for corrupted LZ4 block input stream ([#7](https://redirect.github.com/yawkat/lz4-java/issues/7)) * See full diff in [compare view](yawkat/lz4-java@v1.10.0...v1.10.1) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
…ne [skip ci] Bumps [at.yawk.lz4:lz4-java](https://github.com/yawkat/lz4-java) from 1.10.0 to 1.10.1. Release notes *Sourced from [at.yawk.lz4:lz4-java's releases](https://github.com/yawkat/lz4-java/releases).* > lz4-java v1.10.1 > ---------------- > > Contains fix for [CVE-2025-66566](GHSA-cmp6-m4wj-q63q)! > > What's Changed > -------------- > > * Add test for corrupted LZ4 block input stream by [`@Marcono1234`](https://github.com/Marcono1234) in [yawkat/lz4-java#7](https://redirect.github.com/yawkat/lz4-java/pull/7) > * Update documentation for checksum registration by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#8](https://redirect.github.com/yawkat/lz4-java/pull/8) > * Migrate to maven-git-versioning-extension by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#10](https://redirect.github.com/yawkat/lz4-java/pull/10) > * Add workflow\_dispatch trigger to multi-platform build to allow testing without release by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#13](https://redirect.github.com/yawkat/lz4-java/pull/13) > * Copy native libraries to target/classes instead of src/resources by [`@yawkat`](https://github.com/yawkat) in [yawkat/lz4-java#14](https://redirect.github.com/yawkat/lz4-java/pull/14) > > **Full Changelog**: <yawkat/lz4-java@v1.10.0...v1.10.1> Commits * [`33d180c`](yawkat/lz4-java@33d180c) Merge commit from fork * [`da95a00`](yawkat/lz4-java@da95a00) Copy native libraries to target/classes instead of src/resources ([#14](https://redirect.github.com/yawkat/lz4-java/issues/14)) * [`1e9bf8c`](yawkat/lz4-java@1e9bf8c) Add workflow\_dispatch trigger to multi-platform build to allow testing withou... * [`89c02be`](yawkat/lz4-java@89c02be) Migrate to maven-git-versioning-extension ([#10](https://redirect.github.com/yawkat/lz4-java/issues/10)) * [`d948832`](yawkat/lz4-java@d948832) Update documentation for checksum registration ([#8](https://redirect.github.com/yawkat/lz4-java/issues/8)) * [`02bbbf0`](yawkat/lz4-java@02bbbf0) Add test for corrupted LZ4 block input stream ([#7](https://redirect.github.com/yawkat/lz4-java/issues/7)) * See full diff in [compare view](yawkat/lz4-java@v1.10.0...v1.10.1) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/ArcadeData/arcadedb/network/alerts).
Follow-up for #3
Covers all the 3
IOException("Stream is corrupted", ...)exceptions thrown here (one of which was added in #3):lz4-java/src/java/net/jpountz/lz4/LZ4BlockInputStream.java
Lines 291 to 305 in d2d01a7