avformat/mxfdec: Check size to avoid integer overflow in mxf_read_utf16_string()
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 21 Oct 2016 17:45:21 +0000 (19:45 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 21 Oct 2016 18:06:29 +0000 (20:06 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mxfdec.c

index cdb5c4e..d2166ee 100644 (file)
@@ -717,7 +717,7 @@ static inline int mxf_read_utf16_string(AVIOContext *pb, int size, char** str, i
     int ret;
     size_t buf_size;
 
-    if (size < 0)
+    if (size < 0 || size > INT_MAX/2)
         return AVERROR(EINVAL);
 
     buf_size = size + size / 2 + 1;