From: Georgi Gerganov Date: Fri, 7 Oct 2022 21:14:05 +0000 (+0300) Subject: whisper : fix bug in token sampling logic X-Git-Tag: upstream/1.7.4~1987 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=332c9d77fe1671b9a93975d80c712ee7f2e154b3;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp whisper : fix bug in token sampling logic Could overflow buffer --- diff --git a/whisper.cpp b/whisper.cpp index 9913ab6a..cb15b986 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2470,7 +2470,7 @@ int whisper_full( result_all.push_back({ t0, t1, text }); } text = ""; - while (result_cur[i].id > whisper_token_beg(ctx) && i < (int) result_cur.size()) { + while (i < (int) result_cur.size() && result_cur[i].id > whisper_token_beg(ctx)) { i++; } i--;