From d7fd6e0f1a4106690af7901173f421ea2fb1ea40 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 2 Mar 2019 14:29:04 +0100 Subject: [PATCH] Corrected issue with possible 0 division Reported on rfxgen tool, it crashes on some parameters --- src/raudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raudio.c b/src/raudio.c index 5f42222e..d24cc8e6 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -367,7 +367,7 @@ static mal_uint32 OnAudioBufferDSPRead(mal_dsp *pDSP, mal_uint32 frameCount, voi { AudioBuffer *audioBuffer = (AudioBuffer *)pUserData; - mal_uint32 subBufferSizeInFrames = audioBuffer->bufferSizeInFrames/2; + mal_uint32 subBufferSizeInFrames = (audioBuffer->bufferSizeInFrames > 1)? audioBuffer->bufferSizeInFrames/2 : audioBuffer->bufferSizeInFrames; mal_uint32 currentSubBufferIndex = audioBuffer->frameCursorPos/subBufferSizeInFrames; if (currentSubBufferIndex > 1)