From 431838a3059c462a412c2eafb27c93b7dbb75114 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Tue, 12 Nov 2024 16:36:33 +0100 Subject: [PATCH] Don't overwrite abort or out-of-memory with seek error --- src/libFLAC/stream_decoder.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 5f21719395..0e09f7a6e1 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -3653,7 +3653,8 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s continue; } else { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; + if(decoder->protected_->state != FLAC__STREAM_DECODER_ABORTED && decoder->protected_->state != FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR) + decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } } @@ -3846,7 +3847,8 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint decoder->private_->got_a_frame = false; if(!FLAC__stream_decoder_process_single(decoder) || decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; + if(decoder->protected_->state != FLAC__STREAM_DECODER_ABORTED && decoder->protected_->state != FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR) + decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } if(!decoder->private_->got_a_frame) {