Browse Source

lavf/mov.c: Avoid heap allocation wraps in mov_read_{senc,saiz}()

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 36aba43bd5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.1.8
Matt Wolenetz Michael Niedermayer 9 years ago
parent
commit
5cd2fcd0a7
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      libavformat/mov.c

+ 7
- 2
libavformat/mov.c View File

@@ -4132,8 +4132,8 @@ static int mov_read_senc(MOVContext *c, AVIOContext *pb, MOVAtom atom)


avio_rb32(pb); /* entries */ 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; return AVERROR_INVALIDDATA;
} }


@@ -4201,6 +4201,11 @@ static int mov_read_saiz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0; 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 */ /* save the auxiliary info sizes as is */
data_size = atom.size - atom_header_size; data_size = atom.size - atom_header_size;




Loading…
Cancel
Save