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)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 7 Sep 2013 08:18:59 +0000 (10:18 +0200)
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 147c24c..fe4d932 100644 (file)
@@ -1157,7 +1157,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");