summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wolenetz <[email protected]>2016-12-14 15:24:42 -0800
committerMichael Niedermayer <[email protected]>2017-02-08 20:32:01 +0100
commitb6efd022b77349f2797afe756b791e82ec4a1d96 (patch)
tree548026388a0b263fee5cd7d11a1af526647599cb
parent68e9caf16f4421478634c1c2ffc4706393304db3 (diff)
lavf/mov.c: Avoid heap allocation wrap in mov_read_hdlr
Core of patch is from [email protected] Reference https://crbug.com/643950 Signed-off-by: Michael Niedermayer <[email protected]> Check value reduced as the code does not support larger lengths (cherry picked from commit fd30e4d57fe5841385f845440688505b88c0f4a9) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavformat/mov.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index dd746b4235..e4e00ac992 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -718,6 +718,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);