mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3394] [CLOSED] [Engine] make strata-gguf --check reject invalid files #4613
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4613
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3394
Author: @j-luwierski
Created: 10/20/2026
Status: ❌ Closed
Base:
main← Head:codex/gguf-check-validation-rebased📝 Commits (1)
a2aee5f[Engine] reject invalid strata-gguf checks📊 Changes
3 files changed (+113 additions, -3 deletions)
View changed files
📝
CMakeLists.txt(+4 -0)📝
src/artifact/gguf_reader.cpp(+6 -3)➕
tests/core/gguf_cli_test.cpp(+103 -0)📄 Description
Problem and result
On current
main(5bda973a),strata-gguf FILE --checkprints an architecture failure but returns status 0. Its geometry check can also accept an out-of-file tensor offset when unsigned subtraction wraps, and a tensor whose byte count overflows. After this change, these checks return status 1. Inspection without--checkremains unchanged.Related discussion
Rechecked after the 0.2.0-beta tracker reset: #3043 and #3044. The maintainer noted that closure during the reset does not mean rejection.
Approach
Use the existing overflow-safe
tensor_payload_bytes()helper, validate the payload offset before subtracting, and return failure when the architecture guard reports an error. Add a CPU-only CTest that invokes the actual CLI entry point on synthetic GGUFs covering valid and invalid inputs.Validation
Environment: Linux x86_64, GCC 14.2.0. Tested on current
main5bda973a4331212494d74cf35927ada7f0e063e7plus candidatea2aee5fb.Passed:
cmake -S . -B build-pr3044 -DSTRATA_BUILD_TESTS=ON -DSTRATA_WERROR=ON -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_ENABLE_HIP=OFF -DSTRATA_ENABLE_SYCL=OFF: configured successfully.cmake --build build-pr3044 --target strata-gguf gguf_cli_test gguf_reader_test gguf_split_test gguf_geometry_test model_family_test -j2: all targets built.ctest --test-dir build-pr3044 --output-on-failure -R '^(gguf_cli_test|gguf_reader_test|gguf_split_test|gguf_geometry_test|model_family_test)$': 5/5 passed.git diff --cached --check: clean.Failed on unchanged base (expected regression evidence):
5bda973a. It exited 1 because unsupported and missing architecture, a wrapped out-of-file offset, and an overflowing tensor byte count returned 0 instead of 1. The valid file, inspection-only mode, ordinary out-of-file offset and truncation cases behaved as expected.Not run:
Limits
The check still reports unknown tensor types separately; this change only makes known invalid payload bounds and architecture failures affect the exit status.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.