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

This commit is contained in:
Vincenzo Reina
2026-10-02 15:21:13 +02:00
committed by GitHub
parent 6e4ab854f6
commit 60c0be6ac8
2 changed files with 13 additions and 0 deletions
+5
View File
@@ -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) {
+8
View File
@@ -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 };