AUDIO: Fix VOC infinite loop

This fixes a possible infinite loop in VocStream. It depends on the stream size
matching the size specified in the VOC block headers, but if the size in the
headers is incorrect and larger than the stream size, it will keep trying to
read the stream. This is fixed by adding an end-of-stream check to the error
check.
This commit is contained in:
Coen Rampen 2022-06-18 13:30:03 +02:00 committed by Filippos Karapetis
parent 796166b501
commit e208659aa8

View file

@ -168,9 +168,9 @@ int VocStream::fillBuffer(int maxSamples) {
maxSamples -= samplesRead;
_blockLeft -= samplesRead;
// In case of an error we will stop
// In case of an error or end of stream we will stop
// stream playback.
if (_stream->err()) {
if (_stream->err() || _stream->eos()) {
_blockLeft = 0;
_curBlock = _blocks.end();
break;