diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2011-03-24 02:28:19 +0300 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2011-03-24 02:29:25 +0300 |
commit | 2851b1f6566580485dceb67cbb6b93f64ee9a9bd (patch) | |
tree | 411ceadf022dff1c8469a9b5ad0bf94977ed21c7 /libavformat/matroskadec.c | |
parent | 2a0d4d4cd0119cfe9e439afe5941aee2ca0c1109 (diff) |
matroskadec: check that pointers were initialized before accessing them
fix ticket #14
Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index d99b6ed487..3358e038f5 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1085,19 +1085,21 @@ static void matroska_convert_tags(AVFormatContext *s) if (tags[i].target.attachuid) { MatroskaAttachement *attachment = matroska->attachments.elem; for (j=0; j<matroska->attachments.nb_elem; j++) - if (attachment[j].uid == tags[i].target.attachuid) + if (attachment[j].uid == tags[i].target.attachuid + && attachment[j].stream) matroska_convert_tag(s, &tags[i].tag, &attachment[j].stream->metadata, NULL); } else if (tags[i].target.chapteruid) { MatroskaChapter *chapter = matroska->chapters.elem; for (j=0; j<matroska->chapters.nb_elem; j++) - if (chapter[j].uid == tags[i].target.chapteruid) + if (chapter[j].uid == tags[i].target.chapteruid + && chapter[j].chapter) matroska_convert_tag(s, &tags[i].tag, &chapter[j].chapter->metadata, NULL); } else if (tags[i].target.trackuid) { MatroskaTrack *track = matroska->tracks.elem; for (j=0; j<matroska->tracks.nb_elem; j++) - if (track[j].uid == tags[i].target.trackuid) + if (track[j].uid == tags[i].target.trackuid && track[j].stream) matroska_convert_tag(s, &tags[i].tag, &track[j].stream->metadata, NULL); } else { |