diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2022-06-08 22:29:52 +0200 |
---|---|---|
committer | Martijn van Beurden <mvanb1@gmail.com> | 2022-06-15 07:46:48 +0200 |
commit | bef0c92d0544226eab553db751d9842a7d3c36cc (patch) | |
tree | d554a26405754b828b7059e8fe8c4746bbaef228 | |
parent | 81c973fa1c0fd90edf5789c3c0573b4867799110 (diff) | |
download | flac-bef0c92d0544226eab553db751d9842a7d3c36cc.tar.gz |
Add check for unsigned integer underflow in seeking code
-rw-r--r-- | src/libFLAC/stream_decoder.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 195aa678..beb1384d 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -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; |