Blame SOURCES/0001-ModuleState-handle-compress-decompress-init-failure.patch

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