Skip to content

Commit

Permalink
whisper : fix bug in token sampling logic
Browse files Browse the repository at this point in the history
Could overflow buffer
  • Loading branch information
ggerganov committed Oct 7, 2022
1 parent 0c71065 commit 90513c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
Expand Down

0 comments on commit 90513c3

Please sign in to comment.