aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wolenetz <wolenetz@google.com>2016-12-14 15:24:42 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-08 04:08:25 +0100
commitcf8e004a51b08c6e8ceaeebca85ab84c7ed0b4cf (patch)
treee1da4dfe64df5828091c9ceaf23995e79c471621
parenta1a14982ec5b9954637cdc9ce8daf01d211e5c79 (diff)
downloadffmpeg-cf8e004a51b08c6e8ceaeebca85ab84c7ed0b4cf.tar.gz
lavf/mov.c: Avoid heap allocation wrap in mov_read_hdlr
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 (cherry picked from commit fd30e4d57fe5841385f845440688505b88c0f4a9) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mov.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1e2141808d..17d0475aae 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -739,6 +739,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);