avformat/mxfdec: check avio_read(UID) result
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 10 Jan 2014 01:11:20 +0000 (02:11 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 13 Jan 2014 15:09:15 +0000 (16:09 +0100)
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7fc9ba2fd98e_82_02785736.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4162ceea93684f3cd656dc21d30903e102a44e73)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mxfdec.c

index 3d87e96..e6352de 100644 (file)
@@ -484,7 +484,10 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
     partition->index_sid = avio_rb32(pb);
     avio_skip(pb, 8);
     partition->body_sid = avio_rb32(pb);
-    avio_read(pb, op, sizeof(UID));
+    if (avio_read(pb, op, sizeof(UID)) != sizeof(UID)) {
+        av_log(mxf->fc, AV_LOG_ERROR, "Failed reading UID\n");
+        return AVERROR_INVALIDDATA;
+    }
     nb_essence_containers = avio_rb32(pb);
 
     /* some files don'thave FooterPartition set in every partition */