projects/guix·blob java-team · refs

36 lines · 1.2 KiB

1From: Antonio Larrosa <[email protected]>
2Date: Mon, 6 Mar 2017 18:59:26 +0100
3Subject: Actually fail when error occurs in parseFormat
4
5When there's an unsupported number of bits per sample or an invalid
6number of samples per block, don't only print an error message using
7the error handler, but actually stop parsing the file.
8
9This fixes #35 (also reported at
10https://bugzilla.opensuse.org/show_bug.cgi?id=1026983 and
11https://blogs.gentoo.org/ago/2017/02/20/audiofile-heap-based-buffer-overflow-in-imadecodeblockwave-ima-cpp/
12)
13---
14 libaudiofile/WAVE.cpp | 2 ++
15 1 file changed, 2 insertions(+)
16
17diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
18index 0fc48e8..d04b796 100644
19--- a/libaudiofile/WAVE.cpp
20+++ b/libaudiofile/WAVE.cpp
21@@ -332,6 +332,7 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
22 {
23 _af_error(AF_BAD_NOT_IMPLEMENTED,
24 "IMA ADPCM compression supports only 4 bits per sample");
25+ return AF_FAIL;
26 }
27
28 int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount;
29@@ -339,6 +340,7 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
30 {
31 _af_error(AF_BAD_CODEC_CONFIG,
32 "Invalid samples per block for IMA ADPCM compression");
33+ return AF_FAIL;
34 }
35
36 track->f.sampleWidth = 16;