Skip to content

Commit

Permalink
Always check the number of coefficients
Browse files Browse the repository at this point in the history
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
  • Loading branch information
antlarr committed Mar 6, 2017
1 parent b62c902 commit c48e4c6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libaudiofile/WAVE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)

/* numCoefficients should be at least 7. */
assert(numCoefficients >= 7 && numCoefficients <= 255);
if (numCoefficients < 7 || numCoefficients > 255)
{
_af_error(AF_BAD_HEADER,
"Bad number of coefficients");
return AF_FAIL;
}

m_msadpcmNumCoefficients = numCoefficients;

Expand Down

0 comments on commit c48e4c6

Please sign in to comment.