From 33bdee667e964fe4f6bc5237304bfcd6d3258135 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 14 Nov 2024 11:23:45 +0200 Subject: [PATCH] speculative : fix out-of-bounds access --- examples/speculative/speculative.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/speculative/speculative.cpp b/examples/speculative/speculative.cpp index a40e755a2..6cafd8a83 100644 --- a/examples/speculative/speculative.cpp +++ b/examples/speculative/speculative.cpp @@ -267,11 +267,12 @@ int main(int argc, char ** argv) { for (size_t i = 0; i < dist_tgt.size; i++) { if (dist_tgt.data[i].id == drafts[s].tokens[i_dft]) { p_tgt = dist_tgt.data[i].p; + break; } + } + for (size_t i = 0; i < dist_dft.size; i++) { if (dist_dft.data[i].id == drafts[s].tokens[i_dft]) { p_dft = dist_dft.data[i].p; - } - if (p_tgt && p_dft) { break; } }