From ea949ab873a6b7ede1a877a06114d7162a31deaa Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Tue, 16 Jul 2019 20:58:00 +0300 Subject: [PATCH] Fix invalid write in AudioStreamSample::save_to_wav Fixes #29955 --- scene/resources/audio_stream_sample.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 4b3e3920134..5b61654c5df 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -564,7 +564,8 @@ Error AudioStreamSample::save_to_wav(const String &p_path) { file->store_32(sub_chunk_2_size); //Subchunk2Size // Add data - PoolVector::Read read_data = get_data().read(); + PoolVector data = get_data(); + PoolVector::Read read_data = data.read(); switch (format) { case AudioStreamSample::FORMAT_8_BITS: for (unsigned int i = 0; i < data_bytes; i++) {