SDL: Fix buffer overrun in ConvertAudio with different src/dst channel count

From 72a3eae0da06babf5daa22ead75b107961a64a56 Mon Sep 17 00:00:00 2001
From: hspir404 <[EMAIL REDACTED]>
Date: Thu, 23 Jan 2025 02:32:00 -0800
Subject: [PATCH] Fix buffer overrun in ConvertAudio with different src/dst
 channel count

- Source or destination format also has to not be F32 to trigger bug
---
 src/audio/SDL_audiocvt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index daf44da02b80e..f128f8b5ae5f8 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -325,7 +325,7 @@ void ConvertAudio(int num_frames,
 
     // Gain adjustment
     if (gain != 1.0f) {
-        float *buf = (float *)(dstconvert ? scratch : dst);
+        float *buf = (float *)((channelconvert || dstconvert) ? scratch : dst);
         const int total_samples = num_frames * src_channels;
         if (src == buf) {
             for (int i = 0; i < total_samples; i++) {