fix(par2): fall back to article-size block when SliceSize exceeds file size#223
Merged
Conversation
…e size When the configured SliceSize is larger than the file being processed, the previous code clamped it to (file.Size/128)*128, which produces a block size ≈ file.Size. This creates only 1-2 input slices with a nearly-zero last slice — a pathological configuration that triggers undefined behavior in the ParPar C SIMD backend (AVX-512) on Linux x86_64, causing a segfault in CI. Instead, fall back to calculateParBlockSize() which yields a sensible number of equal slices (same as par2go's own test suite uses), and is known-safe on all platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/par2on Linux CI (run #25039127340)SliceSize > file.Size, the previous code clamped to(file.Size/128)*128 ≈ file.Size, creating only 1–2 input slices with a near-zero last slice — a pathological configuration that triggers undefined behavior in the ParPar C SIMD backend (AVX-512) on Linux x86_64SliceSizewhen it exceeds the file and fall back tocalculateParBlockSize(), which produces a sensible number of equal slices (same as par2go's own tests use)Test plan
./internal/par2/...unit tests pass locally (okin 0.6s)TestIntegration_NativeExecutor_RegeneratesWhenNoPar2FilesExist(the previously crashing test) should now pass on Linux CISliceSize <= file.Size