Commit a52177b0 authored by Max Kellermann's avatar Max Kellermann Committed by Erik de Castro Lopo
Browse files

stream_decoder: reset has_seek_table before read_metadata_seektable_()

If a seek table has already been read successfully, then the
has_seek_table flag is true.  Now imagine the file comes with another
seek table, which doesn't make sense, but libFLAC accepts it happily.
If reading this second seek table fails (for example allocation
failure), read_metadata_seektable_() returns false, but the
has_seek_table flag is still true.  If the calling application happens
to ignore this failure, and at some point tries to seek, the process
will crash due to NULL pointer dereference.  This would sure be an
application bug that needs to be fixed, but libFLAC's internal state
is inconsistent, so let's fix this up.
Signed-off-by: Erik de Castro Lopo's avatarErik de Castro Lopo <>
parent f7491f97
......@@ -1418,6 +1418,9 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
decoder->private_->metadata_callback(decoder, &decoder->private_->stream_info, decoder->private_->client_data);
/* 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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment