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

fix #1374 #1380

Merged
merged 2 commits into from
Mar 22, 2024
Merged

fix #1374 #1380

merged 2 commits into from
Mar 22, 2024

Conversation

Cyan4973
Copy link
Member

@Cyan4973 Cyan4973 commented Mar 22, 2024

The internal output buffer size is sized using the function LZ4F_compressFrameBound(), with parameter NULL.
A mention specifies "cover worst scenario", but that was incorrect : using NULL covers the default scenario, and there are ways to make the situation worse by using advanced command line options, like -B4. In some limit scenarios, it leads to situations where the output buffer is not deemed large enough to guarantee a successful compression.

Switched to determining the main ingredients of LZ4F_preferences_t during initialization and using actual compression parameters to determine the output buffer size, thus avoiding corner cases like #1374 where it's under-sized.

Added test from #1379 , where it was failing without this patch.

fix #1374

The output buffer size was sized using the function `LZ4F_compressFrameBound(, NULL)`,
with the mention "cover worst scenario".
That's incorrect : using `, NULL` covers the _default_ scenario,
and there are ways to make the situation worse
by using advanced command line options, starting with `-B4`.
In some limit scenarios, it leads to situations where the output buffer is not large enough.

Switched to determining the main ingredients of LZ4F_preferences_t during initialization
and using actual compression parameters to determine the output buffer size
thus avoiding corner cases where it's under-sized.
@Cyan4973 Cyan4973 self-assigned this Mar 22, 2024
@Cyan4973 Cyan4973 merged commit 5b4f996 into dev Mar 22, 2024
127 checks passed
@Cyan4973 Cyan4973 deleted the fix1374 branch July 21, 2024 04:10
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.

Error when compressing files of specific size with -B4 on the command line
1 participant