From fcf8a9485cc04ac010f5a751d7ca86da7b4b6638 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 29 Jul 2017 01:25:35 +0200 Subject: [PATCH] Fix outbuf only being partially cleared when trying to read after EOF --- src/coding/vorbis_custom_decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coding/vorbis_custom_decoder.c b/src/coding/vorbis_custom_decoder.c index 10758d8c..b0b15515 100644 --- a/src/coding/vorbis_custom_decoder.c +++ b/src/coding/vorbis_custom_decoder.c @@ -83,8 +83,8 @@ void decode_vorbis_custom(VGMSTREAM * vgmstream, sample * outbuf, int32_t sample while (samples_done < samples_to_do) { /* extra EOF check for edge cases */ - if (stream->offset > stream_size) { - memset(outbuf + samples_done * channels, 0, (samples_to_do - samples_done) * sizeof(sample)); + if (stream->offset >= stream_size) { + memset(outbuf + samples_done * channels, 0, (samples_to_do - samples_done) * sizeof(sample) * channels); break; }