From: Georgi Gerganov Date: Mon, 23 Mar 2026 12:08:46 +0000 (+0200) Subject: memory : fix seq_id bounds in llama_memory_recurrent::state_read_meta() (#20887) X-Git-Tag: upstream/0.0.8611~124 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=f93c09e2673090b59802f2552848a1cac70598b0;p=pkg%2Fggml%2Fsources%2Fllama.cpp memory : fix seq_id bounds in llama_memory_recurrent::state_read_meta() (#20887) --- diff --git a/src/llama-memory-recurrent.cpp b/src/llama-memory-recurrent.cpp index 6e8413f49..44209bd4c 100644 --- a/src/llama-memory-recurrent.cpp +++ b/src/llama-memory-recurrent.cpp @@ -928,11 +928,8 @@ bool llama_memory_recurrent::state_read_meta(llama_io_read_i & io, uint32_t cell llama_seq_id seq_id; io.read_to(&seq_id, sizeof(seq_id)); - // TODO: llama_memory_recurrent should have a notion of max sequences - //if (seq_id < 0 || (uint32_t) seq_id >= llama_n_seq_max(ctx)) { - if (seq_id < 0) { - //LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, %u)\n", __func__, seq_id, llama_n_seq_max(ctx)); - LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, inf)\n", __func__, seq_id); + if (seq_id < 0 || (uint32_t) seq_id >= this->n_seq_max) { + LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, %u)\n", __func__, seq_id, this->n_seq_max); return false; }