From ed4e1c464ee178d99ebe53048ac66e9ed833b1c6 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Tue, 8 Oct 2024 12:50:23 +0200 Subject: [PATCH] Don't try to skip link after allocation failure (#752) Credit: Oss-Fuzz Issue: https://issues.oss-fuzz.com/issues/371233030 --- src/libFLAC/stream_decoder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index bcf89354ad..8f5ca9d99b 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -1230,7 +1230,10 @@ FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_link(FLAC__StreamDecoder *d FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->protected_); - if(!decoder->private_->is_ogg) + if(!decoder->private_->is_ogg || + decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED || + decoder->protected_->state == FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR || + decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED) return false; FLAC__ASSERT_DECLARATION(linknumber_start = decoder->protected_->ogg_decoder_aspect.current_linknumber);