matroskadec: Check that .lang was allocated and set before reading it
authorMartin Storsjö <martin@martin.st>
Tue, 3 Sep 2013 09:10:50 +0000 (12:10 +0300)
committerSean McGovern <gseanmcg@gmail.com>
Mon, 23 Sep 2013 23:50:54 +0000 (19:50 -0400)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5bcd3ae5b167fb74215520b01d5d810e0c8986ab)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavformat/matroskadec.c

index 891eb83..03839f8 100644 (file)
@@ -1079,7 +1079,8 @@ static void matroska_convert_tag(AVFormatContext *s, EbmlList *list,
     int i;
 
     for (i=0; i < list->nb_elem; i++) {
-        const char *lang = strcmp(tags[i].lang, "und") ? tags[i].lang : NULL;
+        const char *lang = tags[i].lang && strcmp(tags[i].lang, "und") ?
+                           tags[i].lang : NULL;
 
         if (!tags[i].name) {
             av_log(s, AV_LOG_WARNING, "Skipping invalid tag with no TagName.\n");