Repository navigation
tools : reject truncated GGUF tensor data in merge - #31044
Merged
ggerganov merged 1 commit intoOct 25, 2026
Merged
Conversation
CISC
approved these changes
Oct 23, 2026
auRose94
pushed a commit
to auRose94/llama.cpp
that referenced
this pull request
Oct 28, 2026
Co-authored-by: Shreya Agrawal <shreyaagrawal@Shreyas-MacBook-Air.local>
edwardyoon
pushed a commit
to edwardyoon/focus-llama
that referenced
this pull request
Oct 30, 2026
Co-authored-by: Shreya Agrawal <shreyaagrawal@Shreyas-MacBook-Air.local>
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.
Overview
This change addresses missing read-error check when gguf_merge doesn't check f_input.read() return, so truncated split files produce silently corrupt merged output.
My reproduction: truncate a split file to 50%, merge exits 0, 45% of output bytes corrupt
The fix: 4 lines, mirrors the existing check in copy_file_to_file
The changes add short-read checks by checking the stream state in gguf_merge.
Additional information
PR #30497 fixed the same issue in the split path but missed the merge path
Requirements
AI assistance covered investigating the truncated-GGUF issue and analyzing the cause of the unchecked reads.
I applied the patch, built the affected tools, ran the regression tests, reviewed the Git diff, and submitted the changes.