[FFmpeg-cvslog] lavf/mov.c: Avoid heap allocation wrap in mov_read_uuid

Matt Wolenetz git at videolan.org
Wed Feb 8 21:50:28 EET 2017


ffmpeg | branch: release/3.1 | Matt Wolenetz <wolenetz at google.com> | Wed Dec 14 15:26:19 2016 -0800| [02a5e88ebc725b09f675bfcbbd4db1133e41708e] | committer: Michael Niedermayer

lavf/mov.c: Avoid heap allocation wrap in mov_read_uuid

Core of patch is from paul at paulmehta.com
Reference https://crbug.com/643951

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
Check value reduced as the code does not support values beyond INT_MAX
Also the check is moved to a more common place and before integer truncation

(cherry picked from commit 2d453188c2303da641dafb048dc1806790526dfd)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02a5e88ebc725b09f675bfcbbd4db1133e41708e
---

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e4e00ac..268cd27 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3969,7 +3969,7 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
     };
 
-    if (atom.size < sizeof(uuid) || atom.size == INT64_MAX)
+    if (atom.size < sizeof(uuid) || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
         return AVERROR_INVALIDDATA;
 
     ret = avio_read(pb, uuid, sizeof(uuid));



More information about the ffmpeg-cvslog mailing list