From efd98785cf7bc01e5049a441ff55dfae9328de75 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Tue, 28 May 2024 23:53:18 +0200 Subject: [PATCH] Fix heap-use-after-free Fixes issue #2059 AddressSanitizer: heap-use-after-free /home/sdrangel/sdrbase/audio/audiofifo.cpp:80 in AudioFifo::write(unsigned char const*, unsigned int) AddressSanitizer: heap-use-after-free /home/sdrangel/sdrbase/audio/audiofifo.h:49 in AudioFifo::fill() const --- plugins/samplesink/audiooutput/audiooutput.cpp | 1 - plugins/samplesource/audioinput/audioinput.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/plugins/samplesink/audiooutput/audiooutput.cpp b/plugins/samplesink/audiooutput/audiooutput.cpp index 32b20ff4e..5e67a3ed8 100644 --- a/plugins/samplesink/audiooutput/audiooutput.cpp +++ b/plugins/samplesink/audiooutput/audiooutput.cpp @@ -218,7 +218,6 @@ void AudioOutput::applySettings(const AudioOutputSettings& settings, const QList m_audioDeviceIndex = audioDeviceManager->getOutputDeviceIndex(settings.m_deviceName); //qDebug("AMDemod::applySettings: audioDeviceName: %s audioDeviceIndex: %d", qPrintable(settings.m_audioDeviceName), audioDeviceIndex); audioDeviceManager->removeAudioSink(&m_audioFifo); - audioDeviceManager->addAudioSink(&m_audioFifo, getInputMessageQueue(), m_audioDeviceIndex); m_sampleRate = audioDeviceManager->getOutputSampleRate(m_audioDeviceIndex); forwardChange = true; } diff --git a/plugins/samplesource/audioinput/audioinput.cpp b/plugins/samplesource/audioinput/audioinput.cpp index bc7519986..be4bd0513 100644 --- a/plugins/samplesource/audioinput/audioinput.cpp +++ b/plugins/samplesource/audioinput/audioinput.cpp @@ -251,7 +251,6 @@ void AudioInput::applySettings(const AudioInputSettings& settings, QListremoveAudioSource(&m_fifo); - audioDeviceManager->addAudioSource(&m_fifo, getInputMessageQueue(), m_audioDeviceIndex); m_sampleRate = audioDeviceManager->getInputSampleRate(m_audioDeviceIndex); qDebug("AudioInput::applySettings: audioDeviceName: %s audioDeviceIndex: %d sampleRate: %d", qPrintable(settings.m_deviceName), m_audioDeviceIndex, m_sampleRate);