From bedfd053cb4133e01e8083bb73818fdedbae5ea6 Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 7 Jan 2026 12:13:18 +1000 Subject: [PATCH] Fix a bug in the gainer where a null pointer can be offset. --- miniaudio.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index 397948f5..2de7db58 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -50869,15 +50869,15 @@ static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_inte a += d; } } + + pFramesOut = ma_offset_ptr(pFramesOut, interpolatedFrameCount * sizeof(float)); + pFramesIn = ma_offset_ptr(pFramesIn, interpolatedFrameCount * sizeof(float)); } + frameCount -= interpolatedFrameCount; + /* Make sure the timer is updated. */ pGainer->t = (ma_uint32)ma_min(pGainer->t + interpolatedFrameCount, pGainer->config.smoothTimeInFrames); - - /* Adjust our arguments so the next part can work normally. */ - frameCount -= interpolatedFrameCount; - pFramesOut = ma_offset_ptr(pFramesOut, interpolatedFrameCount * sizeof(float)); - pFramesIn = ma_offset_ptr(pFramesIn, interpolatedFrameCount * sizeof(float)); } /* All we need to do here is apply the new gains using an optimized path. */