And properly reset the entries count when resetting the entries. CC: libav-sta...@libav.org
Bug-Id: 929 --- There is a similar problem for other blocks, if you are ok I'd add some sc->${count} = 0 for all of them. And probably some block parsers should also have a av_free(). libavformat/mov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index a556aa7..9d271f8 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) -- 2.6.1 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel