From d5bdca9695861f4a466fa076578f8318fc688768 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 19 Dec 2017 14:23:14 +0000 Subject: [PATCH] Fixed some out-of-range channel copying in the AudioBuffer move operator --- .../juce_audio_basics/buffers/juce_AudioSampleBuffer.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index 883666dc00..97c13756df 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -183,7 +183,9 @@ public: if (numChannels < (int) numElementsInArray (preallocatedChannelSpace)) { channels = preallocatedChannelSpace; - memcpy (preallocatedChannelSpace, other.channels, sizeof (preallocatedChannelSpace)); + + for (int i = 0; i < numChannels; ++i) + preallocatedChannelSpace[i] = other.channels[i]; } else { @@ -207,7 +209,9 @@ public: if (numChannels < (int) numElementsInArray (preallocatedChannelSpace)) { channels = preallocatedChannelSpace; - memcpy (preallocatedChannelSpace, other.channels, sizeof (preallocatedChannelSpace)); + + for (int i = 0; i < numChannels; ++i) + preallocatedChannelSpace[i] = other.channels[i]; } else {