mirror of
https://github.com/azahar-emu/soundtouch
synced 2025-11-07 15:40:04 +01:00
Added minimum size check for WAV header block lengh values
This commit is contained in:
parent
1ab7e7ccd0
commit
9e02d9b04f
@ -530,7 +530,11 @@ int WavInFile::readHeaderBlock()
|
|||||||
// read length of the format field
|
// read length of the format field
|
||||||
if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1;
|
if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1;
|
||||||
// swap byte order if necessary
|
// swap byte order if necessary
|
||||||
_swap32(nLen); // int format_len;
|
_swap32(nLen);
|
||||||
|
|
||||||
|
// verify that header length isn't smaller than expected
|
||||||
|
if (nLen < sizeof(header.format) - 8) return -1;
|
||||||
|
|
||||||
header.format.format_len = nLen;
|
header.format.format_len = nLen;
|
||||||
|
|
||||||
// calculate how much length differs from expected
|
// calculate how much length differs from expected
|
||||||
@ -572,6 +576,10 @@ int WavInFile::readHeaderBlock()
|
|||||||
if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1;
|
if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1;
|
||||||
// swap byte order if necessary
|
// swap byte order if necessary
|
||||||
_swap32(nLen); // int fact_len;
|
_swap32(nLen); // int fact_len;
|
||||||
|
|
||||||
|
// verify that fact length isn't smaller than expected
|
||||||
|
if (nLen < sizeof(header.fact) - 8) return -1;
|
||||||
|
|
||||||
header.fact.fact_len = nLen;
|
header.fact.fact_len = nLen;
|
||||||
|
|
||||||
// calculate how much length differs from expected
|
// calculate how much length differs from expected
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user