aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wolenetz <wolenetz@google.com>2016-12-14 15:27:49 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-10 12:15:17 +0100
commitd4b731e271ba944ade8f6a128271479529507de9 (patch)
tree989287e8f8d9140ab8454935a9cc351a3a0d791e
parent927e59b74acc5286f9e8eeac0fb118410db1c09a (diff)
downloadffmpeg-d4b731e271ba944ade8f6a128271479529507de9.tar.gz
lavf/mov.c: Avoid heap allocation wraps in mov_read_{senc,saiz}()n3.2.4
Core of patch is from paul@paulmehta.com Reference https://crbug.com/643952 (senc,saiz portions) Signed-off-by: Matt Wolenetz <wolenetz@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 36aba43bd5fae8595dd9a566fbcfbbea63f0fca3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mov.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 598ef397c6..ce7e2ec211 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4599,8 +4599,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;
}
@@ -4668,6 +4668,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;