From 1a1b79606bccaf0bf74afaf4e5db586f91efcc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 26 Jan 2024 19:42:25 +0100 Subject: [PATCH] BackgroundAudio Atrac3+: malloc a few extra bytes. Fixes crash reported by Verymelon --- UI/BackgroundAudio.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index 08090f88e4..344d65ed68 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -146,7 +146,9 @@ void WavData::Read(RIFFReader &file_) { int numBytes = file_.GetCurrentChunkSize(); numFrames = numBytes / raw_bytes_per_frame; // numFrames - raw_data = (uint8_t *)malloc(numBytes); + // It seems the atrac3 codec likes to read a little bit outside. + int padding = 16; + raw_data = (uint8_t *)malloc(numBytes + padding); raw_data_size = numBytes; if (num_channels == 1 || num_channels == 2) {