gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / audiofile-check-number-of-coefficients.patch
CommitLineData
a8e14943
HG
1From: Antonio Larrosa <larrosa@kde.org>
2Date: Mon, 6 Mar 2017 12:51:22 +0100
3Subject: Always check the number of coefficients
4
5When building the library with NDEBUG, asserts are eliminated
6so it's better to always check that the number of coefficients
7is inside the array range.
8
9This fixes the 00191-audiofile-indexoob issue in #41
10---
11 libaudiofile/WAVE.cpp | 6 ++++++
12 1 file changed, 6 insertions(+)
13
14diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
15index 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)
19
20 /* numCoefficients should be at least 7. */
21 assert(numCoefficients >= 7 && numCoefficients <= 255);
22+ if (numCoefficients < 7 || numCoefficients > 255)
23+ {
24+ _af_error(AF_BAD_HEADER,
25+ "Bad number of coefficients");
26+ return AF_FAIL;
27+ }
28
29 m_msadpcmNumCoefficients = numCoefficients;
30