Add check for unsigned integer underflow in seeking code

This commit is contained in:
Martijn van Beurden 2022-06-08 22:29:52 +02:00
parent 81c973fa1c
commit bef0c92d05

View File

@ -3383,7 +3383,12 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
* frame, try again. This is very inefficient but shouldn't
* happen often, and a more efficient solution would require
* quite a bit more code */
upper_bound--;
if(upper_bound > 0)
upper_bound--;
else {
decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
return false;
}
continue;
}else if(decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED) {
decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;