Merge pull request #30624 from bojidar-bg/29955-invalid-write-audiostreamsample

Fix invalid write in AudioStreamSample::save_to_wav
This commit is contained in:
Rémi Verschelde 2019-07-17 09:28:28 +02:00 committed by GitHub
commit 5230546d4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -564,7 +564,8 @@ Error AudioStreamSample::save_to_wav(const String &p_path) {
file->store_32(sub_chunk_2_size); //Subchunk2Size
// Add data
PoolVector<uint8_t>::Read read_data = get_data().read();
PoolVector<uint8_t> data = get_data();
PoolVector<uint8_t>::Read read_data = data.read();
switch (format) {
case AudioStreamSample::FORMAT_8_BITS:
for (unsigned int i = 0; i < data_bytes; i++) {