]> git.sesse.net Git - ffmpeg/commitdiff
lavf/mov.c: Avoid heap allocation wrap in mov_read_hdlr
authorMatt Wolenetz <wolenetz@google.com>
Wed, 14 Dec 2016 23:24:42 +0000 (15:24 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 8 Feb 2017 02:31:01 +0000 (03:31 +0100)
Core of patch is from paul@paulmehta.com
Reference https://crbug.com/643950

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Check value reduced as the code does not support larger lengths

libavformat/mov.c

index 6fd43a0a4e3b1550275e47280f980287a882c7cf..8c54539c5fe6384efa635b03cbcfeb6da815e50c 100644 (file)
@@ -742,6 +742,8 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     title_size = atom.size - 24;
     if (title_size > 0) {
+        if (title_size > FFMIN(INT_MAX, SIZE_MAX-1))
+            return AVERROR_INVALIDDATA;
         title_str = av_malloc(title_size + 1); /* Add null terminator */
         if (!title_str)
             return AVERROR(ENOMEM);