summaryrefslogtreecommitdiff
path: root/package/libaudiofile/patches/patch-libaudiofile_WAVE_cpp
blob: 863086d8b6a8fc4502f8294a9961f13ca003d6db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- audiofile-0.3.6.orig/libaudiofile/WAVE.cpp	2013-03-06 06:30:03.000000000 +0100
+++ audiofile-0.3.6/libaudiofile/WAVE.cpp	2017-04-26 02:15:19.828763007 +0200
@@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &
 
 			/* 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;
 
@@ -326,6 +332,7 @@ status WAVEFile::parseFormat(const Tag &
 			{
 				_af_error(AF_BAD_NOT_IMPLEMENTED,
 					"IMA ADPCM compression supports only 4 bits per sample");
+				return AF_FAIL;
 			}
 
 			int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount;
@@ -333,6 +340,7 @@ status WAVEFile::parseFormat(const Tag &
 			{
 				_af_error(AF_BAD_CODEC_CONFIG,
 					"Invalid samples per block for IMA ADPCM compression");
+				return AF_FAIL;
 			}
 
 			track->f.sampleWidth = 16;