From bcd52969a1b91691c61f01684e2a0c3bbcd43ebf Mon Sep 17 00:00:00 2001 From: Li Zhang Date: Thu, 7 Dec 2023 08:07:17 +0000 Subject: [PATCH] fix out of bounds access --- src/turbomind/models/llama/LlamaBatch.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbomind/models/llama/LlamaBatch.cc b/src/turbomind/models/llama/LlamaBatch.cc index 90f303a8bf..6690a05634 100644 --- a/src/turbomind/models/llama/LlamaBatch.cc +++ b/src/turbomind/models/llama/LlamaBatch.cc @@ -525,7 +525,7 @@ void LlamaBatch::Initialize(GenerationState& g) // check if the last sequence is partial int partial = 0; int partial_len = -1; - { + if (state_->active_size) { const int i = state_->active_size - 1; partial = state_->sequences[i]->cache_len + state_->sequences[i]->input_length != state_->h_context_length[i]; if (partial) {