SDL: SDL_CreateAudioStream: check for invalid parameters (c638b)

From c638b4a682a14a1d2dd8d287ab1e239635f3a143 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Mon, 16 Jan 2023 09:21:24 +0100
Subject: [PATCH] SDL_CreateAudioStream: check for invalid parameters

---
 src/audio/SDL_audiocvt.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index be9e9cb34346..7a9dc915d46a 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -1011,6 +1011,16 @@ SDL_NewAudioStream(const SDL_AudioFormat src_format,
     Uint8 pre_resample_channels;
     SDL_AudioStream *retval;
 
+    if (src_channels == 0) {
+        SDL_InvalidParamError("src_channels");
+        return NULL;
+    }
+
+    if (dst_channels == 0) {
+        SDL_InvalidParamError("dst_channels");
+        return NULL;
+    }
+
     retval = (SDL_AudioStream *)SDL_calloc(1, sizeof(SDL_AudioStream));
     if (retval == NULL) {
         SDL_OutOfMemory();