tools: Fix crash can happens on malformed audio wave file

This commit is contained in:
Antoine SOULIER
2022-09-15 13:33:07 -07:00
parent 448f3de31f
commit 8b3720abce

View File

@@ -104,6 +104,9 @@ int wave_read_header(FILE *fp, int *bitdepth, int *samplesize,
if (fread(&format, sizeof(format), 1, fp) != 1
|| format.id != WAVE_FORMAT_ID
|| format.fmt != WAVE_FORMAT_PCM
|| format.channels <= 0
|| format.samplerate <= 0
|| format.framesize <= 0
|| format.byterate != format.samplerate * format.framesize)
return -1;