Add a pedantic fread() compatibility check to the vorbis decoder.

This commit is contained in:
David Reid
2021-07-18 13:50:04 +10:00
parent 22965c2fc1
commit c45afa011e
+5
View File
@@ -90,6 +90,11 @@ static size_t ma_libvorbis_vf_callback__read(void* pBufferOut, size_t size, size
size_t bytesToRead;
size_t bytesRead;
/* For consistency with fread(). If `size` of `count` is 0, return 0 immediately without changing anything. */
if (size == 0 || count == 0) {
return 0;
}
bytesToRead = size * count;
result = pVorbis->onRead(pVorbis->pReadSeekTellUserData, pBufferOut, bytesToRead, &bytesRead);