[FFmpeg-cvslog] matroska: Clear prev_pkt between seeks.

Dale Curtis git at videolan.org
Tue Apr 24 02:43:17 CEST 2012


ffmpeg | branch: master | Dale Curtis <dalecurtis at chromium.org> | Mon Apr 23 16:15:31 2012 +0000| [7521c4bab28ff3a622171be5b39a6b210f4263f0] | committer: Justin Ruggles

matroska: Clear prev_pkt between seeks.

The new incremental parser doesn't always clear prev_pkt,
however the packet queue is cleared when seeking. Which leads
to a use-after-free.

Verified using Valgrind.

Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
Signed-off-by: Justin Ruggles <justin.ruggles at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7521c4bab28ff3a622171be5b39a6b210f4263f0
---

 libavformat/matroskadec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 100b97f..e45cfb0 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2094,6 +2094,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
         avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
         matroska->current_id = 0;
         while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
+            matroska->prev_pkt = NULL;
             matroska_clear_queue(matroska);
             if (matroska_parse_cluster(matroska) < 0)
                 break;



More information about the ffmpeg-cvslog mailing list