Commit 60c0be6a for whisper.cpp

commit 60c0be6ac8fa71b1a2ae2dd938a31a34a508e774
Author: Vincenzo Reina <vincenzoreinaa05@gmail.com>
Date:   Fri Oct 2 14:21:13 2026 +0100

    whisper : add check for ttype in whisper and parakeet (#4091)

diff --git a/src/parakeet.cpp b/src/parakeet.cpp
index 1b11bee1..ed663829 100644
--- a/src/parakeet.cpp
+++ b/src/parakeet.cpp
@@ -1444,6 +1444,11 @@ static bool parakeet_model_load(struct parakeet_model_loader * loader, parakeet_
                   return false;
             }

+            if (ttype < 0 || ttype >= GGML_TYPE_COUNT) {
+                PARAKEET_LOG_ERROR("%s: invalid ttype %d in model file (expected 0 <= ttype < %d)\n", __func__, ttype, GGML_TYPE_COUNT);
+                return false;
+            }
+
             int32_t nelements = 1;
             int32_t ne[4] = { 1, 1, 1, 1 };
             for (int i = 0; i < n_dims; ++i) {
diff --git a/src/whisper.cpp b/src/whisper.cpp
index dd8bd937..1675f33a 100644
--- a/src/whisper.cpp
+++ b/src/whisper.cpp
@@ -1896,6 +1896,10 @@ static bool whisper_model_load(struct whisper_model_loader * loader, whisper_con
                   return false;
               }

+            if (ttype < 0 || ttype >= GGML_TYPE_COUNT) {
+                WHISPER_LOG_ERROR("%s: invalid ttype %d in model file (expected 0 <= ttype < %d)\n", __func__, ttype, GGML_TYPE_COUNT);
+                return false;
+            }

             int32_t nelements = 1;
             int32_t ne[4] = { 1, 1, 1, 1 };
@@ -5172,6 +5176,10 @@ struct whisper_vad_context * whisper_vad_init_with_params(
                   return nullptr;
             }

+            if (ttype < 0 || ttype >= GGML_TYPE_COUNT) {
+                WHISPER_LOG_ERROR("%s: invalid ttype %d in model file (expected 0 <= ttype < %d)\n", __func__, ttype, GGML_TYPE_COUNT);
+                return nullptr;
+            }

             int32_t nelements = 1;
             int32_t ne[4] = { 1, 1, 1, 1 };