]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
whisper : fix index overflow in token-level timestamp logic (#2505)
authorJosscii <redacted>
Wed, 23 Oct 2024 12:14:03 +0000 (20:14 +0800)
committerGitHub <redacted>
Wed, 23 Oct 2024 12:14:03 +0000 (15:14 +0300)
src/whisper.cpp

index 1cde0c94ec048ef40f903a5b066423cc61feeee2..834f09a253932f9d557589bfa8f55d683e18dfe8 100644 (file)
@@ -7019,7 +7019,7 @@ static void whisper_exp_compute_token_level_timestamps(
                         k++;
                     }
                     tokens[j].t1 = sample_to_timestamp(k);
-                    if (j < ns - 1 && tokens[j].t1 > tokens[j + 1].t0) {
+                    if (j < n - 1 && tokens[j].t1 > tokens[j + 1].t0) {
                         tokens[j].t1 = tokens[j + 1].t0;
                     } else {
                         s1 = k;