Repository navigation
SWF(bug): return error for overflowing GGUF tensor directory math - #90
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
5 of 7 tasks
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
Malformed GGUF tensor directory entries now return clean errors instead of panicking in debug builds or wrapping in release builds. Checked arithmetic now covers element counts, byte sizes, absolute offsets, BF16 pre-flight estimates, and the mmap slice bounds.
Root cause:
TensorInfo::num_elements(),tensor_byte_size(),tensor_abs_offset(),est_bf16(), andload_pass()used unchecked arithmetic. A tensor offset ofu64::MAXor dims such as[4294967296, 4294967296]could panic onattempt to multiply/add with overflowin debug, or wrap in release and produce a wrong offset / underestimated OOM footprint beforemmap.get(start..start + raw_len).Test plan
Try it (CPU):
ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-runtime --lib malformed_gguf -- --nocapturemain(5938b44), the debug run failed withattempt to multiply with overflow/attempt to add with overflow; the release run let malformed GGUFs load or fail later with an unrelated mock error instead of the overflow error.4 passed; release targeted →4 passed; fullATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-runtime --lib→588 passed; 0 failed; 11 ignored.cargo fmt --all -- --checkATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests -- -Dwarningsbash scripts/check-license-headers.sh(4283files checked,0invalid)typosNotes for reviewers
The mmap read is now split into
mmap.get(start..)thentail.get(..raw_len)sostart + raw_lencannot wrap. The OOM pre-flight reserve addition usessaturating_add, and combined backbone/mmproj estimates use checked addition. The separate CLIP mmproj patch-frame index issue was left untouched.CLA
Implemented in session Return error for overflowing GGUF tensor directory math
Review with Devin · Open in Devin Desktop