改动 / #3394
#3394 [Engine] make strata-gguf --check reject invalid files
open · @j-luwierski · 0 评论 · 去 GitHub 看
AMD / HIPNVIDIA / CUDAModels & quantsWindowsLinux
说明
## Problem and result On current `main` (`5bda973a`), `strata-gguf FILE --check` prints 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 `--check` remains unchanged. ## Related discussion Rechecked after the 0.2.0-beta tracker reset: [#3043](https://github.com/Niko1221/Strata/issues/3043) and [#3044](https://github.com/Niko1221/Strata/pull/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 `main` `5bda973a4331212494d74cf35927ada7f0e063e7` plus candidate `a2aee5fb`. **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):** - Compiled and ran the new CLI regression test against `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:** - Full repository suite, model inference, Windows/macOS runtime, and CUDA/HIP/SYCL builds. The change is confined to the standalone host CLI and its CPU-only test. ## Limits The check still reports unknown tensor types separately; this change only makes known invalid payload bounds and architecture failures affect the exit status.
本站相关内容
相关页面的快捷入口。