From 6a9c1664b37d1a395f510746123e46d2395f004a Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Thu, 1 Jun 2023 16:50:27 +0200 Subject: [PATCH] Check that seektable length > 0 --- src/libFLAC/stream_decoder.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 6c82cbd7..d66d2ccb 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -1415,12 +1415,14 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) /* just in case we already have a seek table, and reading the next one fails: */ decoder->private_->has_seek_table = false; - if(!read_metadata_seektable_(decoder, is_last, length)) - return false; + if(length > 0) { + if(!read_metadata_seektable_(decoder, is_last, length)) + return false; - decoder->private_->has_seek_table = true; - if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE] && decoder->private_->metadata_callback) - decoder->private_->metadata_callback(decoder, &decoder->private_->seek_table, decoder->private_->client_data); + decoder->private_->has_seek_table = true; + if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE] && decoder->private_->metadata_callback) + decoder->private_->metadata_callback(decoder, &decoder->private_->seek_table, decoder->private_->client_data); + } } else { FLAC__bool skip_it = !decoder->private_->metadata_filter[type];