[libav-stable] matroskadec: Check that .lang was allocated and set before reading it

Martin Storsjö git at libav.org
Tue Sep 3 22:04:56 CEST 2013


Module: libav
Branch: master
Commit: 5bcd3ae5b167fb74215520b01d5d810e0c8986ab

Author:    Martin Storsjö <martin at martin.st>
Committer: Martin Storsjö <martin at martin.st>
Date:      Tue Sep  3 12:10:50 2013 +0300

matroskadec: Check that .lang was allocated and set before reading it

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

---

 libavformat/matroskadec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9b116b0..d5b6071 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1189,7 +1189,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");



More information about the libav-stable mailing list