From f4d8a537e9df4c5f884860dcf2e4ae05926db42e Mon Sep 17 00:00:00 2001 From: David Reid Date: Tue, 22 Nov 2022 21:34:09 +1000 Subject: [PATCH] Check the return value when data is read from a libvorbis file. --- extras/miniaudio_libvorbis.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extras/miniaudio_libvorbis.h b/extras/miniaudio_libvorbis.h index f31b2abf..9a623586 100644 --- a/extras/miniaudio_libvorbis.h +++ b/extras/miniaudio_libvorbis.h @@ -99,6 +99,10 @@ static size_t ma_libvorbis_vf_callback__read(void* pBufferOut, size_t size, size bytesToRead = size * count; result = pVorbis->onRead(pVorbis->pReadSeekTellUserData, pBufferOut, bytesToRead, &bytesRead); + if (result != MA_SUCCESS) { + /* Not entirely sure what to return here. What if an error occurs, but some data was read and bytesRead is > 0? */ + return 0; + } return bytesRead / size; }