EbmlList *seekhead_list = &matroska->seekhead;
int64_t before_pos = avio_tell(matroska->ctx->pb);
int i;
+ int nb_elem;
// we should not do any seeking in the streaming case
if (!matroska->ctx->pb->seekable ||
(matroska->ctx->flags & AVFMT_FLAG_IGNIDX))
return;
- for (i = 0; i < seekhead_list->nb_elem; i++) {
+ // do not read entries that are added while parsing seekhead entries
+ nb_elem = seekhead_list->nb_elem;
+
+ for (i = 0; i < nb_elem; i++) {
MatroskaSeekhead *seekhead = seekhead_list->elem;
if (seekhead[i].pos <= before_pos)
continue;
break;
}
}
+ if (nb_elem != seekhead_list->nb_elem) {
+ avpriv_request_sample(matroska->ctx, "recursive SeekHead elements");
+ }
}
static void matroska_add_index_entries(MatroskaDemuxContext *matroska)
ffio_init_context(&b, track->codec_priv.data,
track->codec_priv.size,
0, NULL, NULL, NULL, NULL);
- ret = ff_get_wav_header(&b, st->codec, track->codec_priv.size);
+ ret = ff_get_wav_header(&b, st->codec, track->codec_priv.size, 0);
if (ret < 0)
return ret;
codec_id = st->codec->codec_id;