diff options
author | Matt Wolenetz <[email protected]> | 2016-12-14 15:27:49 -0800 |
---|---|---|
committer | Michael Niedermayer <[email protected]> | 2017-05-16 16:00:21 +0200 |
commit | 5cd2fcd0a72334d4b3beb32247df3ebd93a7ded9 (patch) | |
tree | 5bcec6db96cacc99282b473d8b205c6f82ef9f09 | |
parent | 0abc88f0fdb829a88e0a147a119d1ed59b89a49e (diff) |
lavf/mov.c: Avoid heap allocation wraps in mov_read_{senc,saiz}()
Core of patch is from [email protected]
Reference https://crbug.com/643952 (senc,saiz portions)
Signed-off-by: Matt Wolenetz <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
(cherry picked from commit 36aba43bd5fae8595dd9a566fbcfbbea63f0fca3)
Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r-- | libavformat/mov.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 2d9447eda0..a77d6908e3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4132,8 +4132,8 @@ static int mov_read_senc(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* entries */ - if (atom.size < 8) { - av_log(c->fc, AV_LOG_ERROR, "senc atom size %"PRId64" too small\n", atom.size); + if (atom.size < 8 || atom.size > FFMIN(INT_MAX, SIZE_MAX)) { + av_log(c->fc, AV_LOG_ERROR, "senc atom size %"PRId64" invalid\n", atom.size); return AVERROR_INVALIDDATA; } @@ -4201,6 +4201,11 @@ static int mov_read_saiz(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } + if (atom.size > FFMIN(INT_MAX, SIZE_MAX)) { + av_log(c->fc, AV_LOG_ERROR, "saiz atom auxiliary_info_sizes size %"PRId64" invalid\n", atom.size); + return AVERROR_INVALIDDATA; + } + /* save the auxiliary info sizes as is */ data_size = atom.size - atom_header_size; |