format: a bailing container must promise a walkable layer count

bailingmoe3_layouts rebuilds the release GGUF's layouts by walking every
layer the container claims -- and it runs on the open path, before any
plugin gets a vote. Its gate checked the counts were positive and nothing
more: a GGUF naming 2^62 blocks sends the name-probe loops over centuries
of iterations. The process never listens, never refuses; StallWatch notes
the silence after two minutes and stops there. A negative
first_k_dense_replace opens a second loop of the same order, starting
below zero. This is a hostile container's permanent hang, the same
supply-chain class as the round-two finding on the shard index: the
refusal must land before the walk.

The gate now caps n_layers at 4096 (the family's real models are an order
of magnitude below; 4096 layers is not a slow load either) and requires
the dense prefix to lie inside the stack. checkpoint_test pins all three
shapes -- 2^62 layers refused, negative prefix refused, a small honest
stack opens as before -- and the test GGUF writer gains the INT64 KV type
they are spelled in, which the u32 field could not carry.

Found by the 2.1.0 review pass (axis: hostile model files).
This commit is contained in:
fl0l0u committed 2026-11-15 21:15:23 +00:00
1 parent 6e8a2f0a94
commit 4943bba2fb
3 files changed
+49 -2

No files matched your search

+8 -1
View File
@@ -3622,7 +3622,14 @@ int Checkpoint::bailingmoe3_layouts() {
const int64_t emb = meta_.m.n_embd;
const char* nexp_s = meta_.get("num_experts");
const int64_t n_expert = nexp_s ? std::stoll(nexp_s) : 0;
if (n_layer < 1 || group < 2 || heads < 1 || latent < 1 || ff < 1 || emb < 1)
/* Every loop below walks to n_layer on the open path, so the counts must be bounded HERE:
* a GGUF claiming 2^62 layers would spend centuries in name probes, never answering, never
* refusing -- a hostile container's hang, not a slow load. No real model of this family is
* near 4096 layers. And the MoE suffix loop starts at the dense prefix, so the prefix must
* lie inside the stack: negative opens a walk of twice the range, beyond the end is a
* container that means nothing by it. */
if (n_layer < 1 || n_layer > 4096 || dense < 0 || dense > n_layer ||
group < 2 || heads < 1 || latent < 1 || ff < 1 || emb < 1)
return RAD_E_FORMAT;
/* Decode a whole source tensor to f32: a block type row by row, a plain one a copy. */