Fix: prevent SIGFPE crash in JoinFile when file segments are empty#772
Merged
dnzbk merged 1 commit intonzbgetcom:developfrom Apr 5, 2026
Merged
Conversation
When joining split files (e.g., .7z.001, .7z.002), totalSize is calculated from fragment sizes. If all fragments are zero-byte or corrupt, totalSize becomes 0 and the progress calculation (written * 1000 / totalSize) triggers a divide-by-zero SIGFPE, crashing nzbget on every startup as it resumes post-processing. Add a guard to return early with an error message when totalSize <= 0.
dnzbk
pushed a commit
that referenced
this pull request
Apr 9, 2026
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.
Description
Fixes #773 — a divide-by-zero crash (SIGFPE) in
UnpackController::JoinFile()that occurs when split file segments (e.g.,.7z.001,.7z.002) are zero-byte or corrupt.When
totalSizeis calculated as 0 from empty fragments, the progress calculation on line 530:triggers a SIGFPE, crashing NZBGet. Since NZBGet resumes post-processing on startup, this causes a crash loop that prevents the application from starting at all.
The fix adds a guard to return early with an error message when
totalSize <= 0, preventing the divide-by-zero.Lib changes
None.
Testing
UnpackController::JoinFileviacoredumpctl info: