summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2016-03-08 11:57:16 +0100
committerLuca Barbato <lu_zero@gentoo.org>2016-03-11 14:29:13 +0100
commit7e01d48cfd168c3dfc663f03a3b6a98e0ecba328 (patch)
treed5d20401db29b87c3e1c7d6b4ef30a6aa7ac6bae /libavformat
parent59b9d2f684f1ff66627ca2b7d2dd05771ade62f0 (diff)
mov: Check the entries value when parsing dref boxes
And properly reset the entries count when resetting the entries. CC: libav-stable@libav.org Bug-Id: 929 Bug-Id: CVE-2016-3062
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a556aa75df..9d271f8974 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -473,9 +473,11 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb32(pb); // version + flags
entries = avio_rb32(pb);
- if (entries > (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
+ if (!entries ||
+ entries > (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
entries >= UINT_MAX / sizeof(*sc->drefs))
return AVERROR_INVALIDDATA;
+ sc->drefs_count = 0;
av_free(sc->drefs);
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
if (!sc->drefs)