From: Georgi Gerganov Date: Sat, 27 Jan 2024 15:33:09 +0000 (+0200) Subject: common : fix input buffer check (#1812) X-Git-Tag: upstream/1.7.4~1070 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=52cce8249304bc00fb2fd5a46cca9d44097a8da0;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp common : fix input buffer check (#1812) --- diff --git a/examples/common.cpp b/examples/common.cpp index 8404e00e..548156ec 100644 --- a/examples/common.cpp +++ b/examples/common.cpp @@ -639,7 +639,7 @@ bool read_wav(const std::string & fname, std::vector& pcmf32, std::vector fprintf(stderr, "%s: read %zu bytes from stdin\n", __func__, wav_data.size()); } - else if (fname.size() > 256 || fname.size() > 40 && fname.substr(0, 4) == "RIFF" && fname.substr(8, 4) == "WAVE") { + else if (fname.size() > 256 && (fname.substr(0, 4) == "RIFF" || fname.substr(8, 4) == "WAVE")) { if (drwav_init_memory(&wav, fname.c_str(), fname.size(), nullptr) == false) { fprintf(stderr, "error: failed to open WAV file from fname buffer\n"); return false;