mvdec: check var_read_string() return value
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 27 Jan 2013 01:14:38 +0000 (02:14 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 27 Jan 2013 01:15:02 +0000 (02:15 +0100)
Prevent null pointer dereference

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

index 03471f1..103a40a 100644 (file)
@@ -158,6 +158,8 @@ static int parse_video_var(AVFormatContext *avctx, AVStream *st, const char *nam
         st->nb_frames = st->duration = var_read_int(pb, size);
     } else if (!strcmp(name, "COMPRESSION")) {
         char * str = var_read_string(pb, size);
+        if (!str)
+            return AVERROR_INVALIDDATA;
         if (!strcmp(str, "1")) {
             st->codec->codec_id = AV_CODEC_ID_MVC1;
         } else if (!strcmp(str, "2")) {