From 2d5f5b30277bbb6ead6b0417ffb7f6e3f89aeffb Mon Sep 17 00:00:00 2001 From: Li Zhang Date: Thu, 7 Dec 2023 17:58:54 +0800 Subject: [PATCH] fix out of bounds access (#809) --- 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) {