Skip to content

Conversation

@Marcono1234
Copy link

Follow-up for #3

Covers all the 3 IOException("Stream is corrupted", ...) exceptions thrown here (one of which was added in #3):

try {
if (fastDecompressor == null) {
final int decompressedLen = safeDecompressor.decompress(compressedBuffer, 0, compressedLen, buffer, 0, originalLen);
if (decompressedLen != originalLen) {
throw new IOException("Stream is corrupted");
}
} else {
final int compressedLen2 = fastDecompressor.decompress(compressedBuffer, 0, buffer, 0, originalLen);
if (compressedLen != compressedLen2) {
throw new IOException("Stream is corrupted");
}
}
} catch (LZ4Exception e) {
throw new IOException("Stream is corrupted", e);
}

@Marcono1234 Marcono1234 force-pushed the block-input-stream-corrupted-test branch from e508bad to 043c458 Compare December 2, 2025 13:30
// 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()) }
Copy link
Author

@Marcono1234 Marcono1234 Dec 2, 2025

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).

Copy link
Owner

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

@yawkat
Copy link
Owner

yawkat commented Dec 2, 2025

LGTM

@yawkat yawkat merged commit 02bbbf0 into yawkat:main Dec 2, 2025
1 check passed
@Marcono1234 Marcono1234 deleted the block-input-stream-corrupted-test branch December 2, 2025 13:41
mergify bot added a commit to ArcadeData/arcadedb that referenced this pull request Dec 8, 2025
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)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=at.yawk.lz4:lz4-java&package-manager=maven&previous-version=1.10.0&new-version=1.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)
mergify bot added a commit to ArcadeData/arcadedb that referenced this pull request Dec 8, 2025
…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)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=at.yawk.lz4:lz4-java&package-manager=maven&previous-version=1.10.0&new-version=1.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).
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

Successfully merging this pull request may close these issues.

2 participants