From 35facc36561f03ed12abcb5cd1013075c5c599fc Mon Sep 17 00:00:00 2001 From: hogliux Date: Tue, 29 Aug 2017 11:39:26 +0100 Subject: [PATCH] Fixed a potential use-after-free in AudioBuffer's move semantics --- modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index 04dc758135..7702b6e70d 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -184,7 +184,7 @@ public: : numChannels (other.numChannels), size (other.size), allocatedBytes (other.allocatedBytes), - channels (other.channels), + channels (numChannels < (int) numElementsInArray (preallocatedChannelSpace) ? preallocatedChannelSpace : other.channels), allocatedData (static_cast&&> (other.allocatedData)), isClear (other.isClear) { @@ -200,7 +200,7 @@ public: numChannels = other.numChannels; size = other.size; allocatedBytes = other.allocatedBytes; - channels = other.channels; + channels = numChannels < (int) numElementsInArray (preallocatedChannelSpace) ? preallocatedChannelSpace : other.channels; allocatedData = static_cast&&> (other.allocatedData); isClear = other.isClear; memcpy (preallocatedChannelSpace, other.preallocatedChannelSpace, sizeof (preallocatedChannelSpace));