Skip to content
Permalink
Browse files

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
  • Loading branch information
lu-zero committed Mar 8, 2016
1 parent 59b9d2f commit 7e01d48cfd168c3dfc663f03a3b6a98e0ecba328
Showing with 3 additions and 1 deletion.
  1. +3 −1 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)

0 comments on commit 7e01d48

Please sign in to comment.
You can’t perform that action at this time.