gguf_reader: open a tensor-less shard that ends before its aligned data start

unsloth/Qwen3.8-Flash-Next-GGUF UD-Q5_K_XL shard 1 holds metadata only and
is 10,946,618 bytes; its 32-byte-aligned data start is 10,946,624, so the
engine refused it with 'GGUF: data section starts past EOF'. llama.cpp's
gguf-py reads the same file (0 tensors, data_offset 10,946,624).

A file with tensors is still refused. A file without them gets data_start
clamped to the file size, so file_size() - data_start() stays 0 in the
payload checks downstream.
This commit is contained in:
CYoung83 authored and Niko1221 committed 2026-10-09 03:06:46 +02:00
1 parent de21371b8a
commit 5fde38470a
1 file changed
+8 -1
+8 -1
View File
@@ -455,7 +455,14 @@ private:
if (a->u) align = a->u;
alignment_ = align;
data_start_ = (c.pos() + align - 1) / align * align;
if (data_start_ > size_) throw std::runtime_error("GGUF: data section starts past EOF");
if (data_start_ > size_) {
// A file with tensors needs its data section. One without (a split model's metadata-only first
// shard) may end at its header, before the aligned start - unsloth's UD-Q5_K_XL shard 1 ends 6 bytes
// short, and llama.cpp's gguf-py reads it. Nothing is read there; the clamp keeps
// `file_size() - data_start()` (the payload checks downstream) at 0 instead of wrapping.
if (n_tensors != 0) throw std::runtime_error("GGUF: data section starts past EOF");
data_start_ = size_;
}
}
std::string path_;