1 From fde6d79fb8363c4a329a184ef0b107156602b225 Mon Sep 17 00:00:00 2001
2 From: Wim Taymans <wtaymans@redhat.com>
3 Date: Thu, 27 Sep 2018 10:48:45 +0200
4 Subject: [PATCH] ModuleState: handle compress/decompress init failure
6 When the unit initcompress or initdecompress function fails,
7 m_fileModule is NULL. Return AF_FAIL in that case instead of
8 causing NULL pointer dereferences later.
12 libaudiofile/modules/ModuleState.cpp | 3 +++
13 1 file changed, 3 insertions(+)
15 diff --git a/libaudiofile/modules/ModuleState.cpp b/libaudiofile/modules/ModuleState.cpp
16 index 0c29d7a..070fd9b 100644
17 --- a/libaudiofile/modules/ModuleState.cpp
18 +++ b/libaudiofile/modules/ModuleState.cpp
19 @@ -75,6 +75,9 @@ status ModuleState::initFileModule(AFfilehandle file, Track *track)
20 m_fileModule = unit->initcompress(track, file->m_fh, file->m_seekok,
21 file->m_fileFormat == AF_FILE_RAWDATA, &chunkFrames);
26 if (unit->needsRebuffer)
28 assert(unit->nativeSampleFormat == AF_SAMPFMT_TWOSCOMP);