Skip to content

Commit f93c09e

Browse files
authored
memory : fix seq_id bounds in llama_memory_recurrent::state_read_meta() (#20887)
1 parent 841bc20 commit f93c09e

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/llama-memory-recurrent.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,11 +928,8 @@ bool llama_memory_recurrent::state_read_meta(llama_io_read_i & io, uint32_t cell
928928
llama_seq_id seq_id;
929929
io.read_to(&seq_id, sizeof(seq_id));
930930

931-
// TODO: llama_memory_recurrent should have a notion of max sequences
932-
//if (seq_id < 0 || (uint32_t) seq_id >= llama_n_seq_max(ctx)) {
933-
if (seq_id < 0) {
934-
//LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, %u)\n", __func__, seq_id, llama_n_seq_max(ctx));
935-
LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, inf)\n", __func__, seq_id);
931+
if (seq_id < 0 || (uint32_t) seq_id >= this->n_seq_max) {
932+
LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, %u)\n", __func__, seq_id, this->n_seq_max);
936933
return false;
937934
}
938935

0 commit comments

Comments
 (0)