Skip to content

Commit c48e4c6

Browse files
committed
Always check the number of coefficients
When building the library with NDEBUG, asserts are eliminated so it's better to always check that the number of coefficients is inside the array range. This fixes the 00191-audiofile-indexoob issue in mpruett#41
1 parent b62c902 commit c48e4c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: libaudiofile/WAVE.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
281281

282282
/* numCoefficients should be at least 7. */
283283
assert(numCoefficients >= 7 && numCoefficients <= 255);
284+
if (numCoefficients < 7 || numCoefficients > 255)
285+
{
286+
_af_error(AF_BAD_HEADER,
287+
"Bad number of coefficients");
288+
return AF_FAIL;
289+
}
284290

285291
m_msadpcmNumCoefficients = numCoefficients;
286292

0 commit comments

Comments
 (0)