Don't overwrite abort or out-of-memory with seek error

This commit is contained in:
Martijn van Beurden 2024-11-12 16:36:33 +01:00
parent c98d86d2bd
commit a0e30a4ef2

View File

@ -1428,6 +1428,7 @@ FLAC_API FLAC__uint64 FLAC__stream_decoder_find_total_samples(FLAC__StreamDecode
decoder->private_->got_a_frame = false;
if(!FLAC__stream_decoder_process_single(decoder) ||
decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED) {
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 0;
}
@ -1440,6 +1441,7 @@ FLAC_API FLAC__uint64 FLAC__stream_decoder_find_total_samples(FLAC__StreamDecode
decoder->private_->fixed_block_size = decoder->private_->last_frame.header.blocksize;
if(!FLAC__stream_decoder_process_single(decoder) ||
decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED) {
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 0;
}
@ -3775,6 +3777,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
continue;
}
else {
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;
}
@ -3963,6 +3966,7 @@ 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) {
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;
}