libFLAC: Fix decoder_flush with uninitialized decoder
authorErik de Castro Lopo <erikd@mega-nerd.com>
Mon, 13 Jul 2015 12:15:58 +0000 (22:15 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Mon, 13 Jul 2015 12:20:29 +0000 (22:20 +1000)
Closes: https://sourceforge.net/p/flac/bugs/428

src/libFLAC/stream_decoder.c

index 231422c..04ce7cd 100644 (file)
@@ -936,6 +936,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder)
        FLAC__ASSERT(0 != decoder->private_);
        FLAC__ASSERT(0 != decoder->protected_);
 
+       if(!decoder->private_->internal_reset_hack && decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED)
+               return false;
+
        decoder->private_->samples_decoded = 0;
        decoder->private_->do_md5_checking = false;