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>
Sun, 4 Dec 2016 19:25:15 +0000 (20:25 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fecb3e82a4ba09dc11a51ad0961ab491881a53a1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mxfdec.c

index f214b36..173a769 100644 (file)
@@ -826,7 +826,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;