fwknop: init script improvements
[feed/packages.git] / libs / libaudiofile / patches / 110-Always-check-the-number-of-coefficients.patch
1 From c48e4c6503f7dabd41f11d4c9c7b7f8960e7f2c0 Mon Sep 17 00:00:00 2001
2 From: Antonio Larrosa <larrosa@kde.org>
3 Date: Mon, 6 Mar 2017 12:51:22 +0100
4 Subject: [PATCH] Always check the number of coefficients
5
6 When building the library with NDEBUG, asserts are eliminated
7 so it's better to always check that the number of coefficients
8 is inside the array range.
9
10 This fixes the 00191-audiofile-indexoob issue in #41
11 ---
12 libaudiofile/WAVE.cpp | 6 ++++++
13 1 file changed, 6 insertions(+)
14
15 diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
16 index 0e81cf7..61f9541 100644
17 --- a/libaudiofile/WAVE.cpp
18 +++ b/libaudiofile/WAVE.cpp
19 @@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
20
21 /* numCoefficients should be at least 7. */
22 assert(numCoefficients >= 7 && numCoefficients <= 255);
23 + if (numCoefficients < 7 || numCoefficients > 255)
24 + {
25 + _af_error(AF_BAD_HEADER,
26 + "Bad number of coefficients");
27 + return AF_FAIL;
28 + }
29
30 m_msadpcmNumCoefficients = numCoefficients;
31
32 --
33 2.11.0
34