From f568dd8a79790b5b8af40fd8ffc420aa5a36f300 Mon Sep 17 00:00:00 2001 From: David Reid Date: Fri, 2 Jul 2021 21:54:50 +1000 Subject: [PATCH] Fix an infinite loop with the Vorbis decoder. --- miniaudio.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index e5cf654a..4f8861fc 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -49492,6 +49492,11 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram } } } + + /* If we don't have a success code at this point it means we've encounted an error or the end of the file has been reached (probably the latter). */ + if (result != MA_SUCCESS) { + break; + } } } else { /* Pull mode. This is the simple case, but we still need to run in a loop because stb_vorbis loves using 32-bit instead of 64-bit. */