wtvdec: Check that stream private context has been allocated before use.
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Apr 2012 13:29:34 +0000 (15:29 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Apr 2012 13:29:34 +0000 (15:29 +0200)
This fixes a null ptr dereference with attachments

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/wtvdec.c

index a2a26c2..e25bb5f 100644 (file)
@@ -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) {