Commit 78e05298f for llama.cpp
commit 78e05298f0d68abff41d08d79fa7469264b2aff0
Author: parthod0x <260393540+parthod0x@users.noreply.github.com>
Date: Thu Nov 19 03:39:55 2026 +0530
model : limite: reject mudd configs that index past mudd_tap_idx on load (#32562)
n_mudd_taps comes from limite.mudd.tap_count, a scalar read separately
from the length-checked tap_indices array. mudd_tap_idx is a fixed
std::array<int32_t, 512> indexed at [i*n_taps] in both the tensor load
and the graph build, so a crafted GGUF with n_layer * n_mudd_taps > 512
reads past the array.
Reject that at hparams load; the one check covers both index sites.
diff --git a/src/models/limite.cpp b/src/models/limite.cpp
index 2bd45561a..887bfef63 100644
--- a/src/models/limite.cpp
+++ b/src/models/limite.cpp
@@ -18,6 +18,12 @@ void llama_model_limite::load_arch_hparams(llama_model_loader & ml) {
std::fill(hparams.mudd_tap_idx.begin(), hparams.mudd_tap_idx.end(), -1);
ml.get_key(LLM_KV_MUDD_TAP_COUNT, hparams.n_mudd_taps, false);
if (hparams.n_mudd_taps > 0) {
+ // reject metadata where n_layer * n_mudd_taps would index past mudd_tap_idx
+ if (hparams.n_mudd_taps > LLAMA_MAX_LAYERS || (uint64_t) hparams.n_layer() * hparams.n_mudd_taps > LLAMA_MAX_LAYERS) {
+ throw std::runtime_error(format(
+ "invalid limite mudd config: n_layer (%u) * n_mudd_taps (%u) exceeds LLAMA_MAX_LAYERS (%d)",
+ hparams.n_layer(), hparams.n_mudd_taps, LLAMA_MAX_LAYERS));
+ }
ml.get_key(LLM_KV_MUDD_FEED_FORWARD_LENGTH, hparams.n_mudd_ff);
ml.get_arr(LLM_KV_MUDD_TAP_INDICES, hparams.mudd_tap_idx);
}