From fd2127ad53370c4f5d615265c4f915126e7d5f4f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 22 Apr 2012 15:29:34 +0200 Subject: [PATCH] wtvdec: Check that stream private context has been allocated before use. This fixes a null ptr dereference with attachments Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavformat/wtvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index a2a26c2ccb..e25bb5ff54 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -833,7 +833,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } } else if (!ff_guidcmp(g, ff_data_guid)) { int stream_index = ff_find_stream_index(s, sid); - if (mode == SEEK_TO_DATA && stream_index >= 0 && len > 32) { + if (mode == SEEK_TO_DATA && stream_index >= 0 && len > 32 && s->streams[stream_index]->priv_data) { WtvStream *wst = s->streams[stream_index]->priv_data; wst->seen_data = 1; if (len_ptr) {