1 From: Antonio Larrosa <larrosa@kde.org>
2 Date: Mon, 6 Mar 2017 12:51:22 +0100
3 Subject: Always check the number of coefficients
5 When building the library with NDEBUG, asserts are eliminated
6 so it's better to always check that the number of coefficients
7 is inside the array range.
9 This fixes the 00191-audiofile-indexoob issue in #41
11 libaudiofile/WAVE.cpp | 6 ++++++
12 1 file changed, 6 insertions(+)
14 diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
15 index 9dd8511..0fc48e8 100644
16 --- a/libaudiofile/WAVE.cpp
17 +++ b/libaudiofile/WAVE.cpp
18 @@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
20 /* numCoefficients should be at least 7. */
21 assert(numCoefficients >= 7 && numCoefficients <= 255);
22 + if (numCoefficients < 7 || numCoefficients > 255)
24 + _af_error(AF_BAD_HEADER,
25 + "Bad number of coefficients");
29 m_msadpcmNumCoefficients = numCoefficients;