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
|
$NetBSD: patch-ad,v 1.1 2009/01/21 15:19:27 drochner Exp $
--- libaudiofile/wave.c.orig 2004-03-06 07:39:23.000000000 +0100
+++ libaudiofile/wave.c
@@ -220,7 +220,8 @@ static status ParseFormat (AFfilehandle
extraByteCount = LENDIAN_TO_HOST_INT16(extraByteCount);
af_fread(&samplesPerBlock, 1, 2, fp);
- samplesPerBlock = LENDIAN_TO_HOST_INT16(samplesPerBlock);
+ samplesPerBlock = LENDIAN_TO_HOST_INT16(samplesPerBlock)
+ * track->f.channelCount;
af_fread(&numCoefficients, 1, 2, fp);
numCoefficients = LENDIAN_TO_HOST_INT16(numCoefficients);
@@ -281,6 +282,12 @@ static status ParseFormat (AFfilehandle
u_int16_t bitsPerSample, extraByteCount,
samplesPerBlock;
+ if (track->f.channelCount != 1) {
+ _af_error(AF_BAD_CHANNELS,
+ "WAVE file with IMA compression: "
+ "can only handle 1 channel");
+ }
+
af_fread(&bitsPerSample, 1, 2, fp);
bitsPerSample = LENDIAN_TO_HOST_INT16(bitsPerSample);
|