summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-26 18:16:15 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-26 18:36:17 +0100
commit1b5d11240692025f036e945bc37968735679320a (patch)
treef0cfa14ddb8a79d44965d1a7a7379566567b17ba /libavformat/mov.c
parent9a53707e86eb066e1c77460215c716f7962c71e7 (diff)
downloadffmpeg-1b5d11240692025f036e945bc37968735679320a.tar.gz
avformat/mov: Fix memleaks for duplicate STCO/CO64/STSC atoms
Also see [FFmpeg-devel] [PATCH] avformat/mov: strengthen some table allocations which contains more fixes but is unfinished Fixes: signal_sigabrt_7ffff6ac7bb9_3484_cov_1830000177_starfox2.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index d65e40f009..a71e36dba8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1275,6 +1275,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (entries >= UINT_MAX/sizeof(int64_t))
return AVERROR_INVALIDDATA;
+ if (sc->chunk_offsets)
+ av_log(c->fc, AV_LOG_WARNING, "Duplicate STCO atom\n");
+ av_free(sc->chunk_offsets);
+ sc->chunk_count = 0;
sc->chunk_offsets = av_malloc(entries * sizeof(int64_t));
if (!sc->chunk_offsets)
return AVERROR(ENOMEM);
@@ -1871,6 +1875,10 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
if (entries >= UINT_MAX / sizeof(*sc->stsc_data))
return AVERROR_INVALIDDATA;
+ if (sc->stsc_data)
+ av_log(c->fc, AV_LOG_WARNING, "Duplicate STSC atom\n");
+ av_free(sc->stsc_data);
+ sc->stsc_count = 0;
sc->stsc_data = av_malloc(entries * sizeof(*sc->stsc_data));
if (!sc->stsc_data)
return AVERROR(ENOMEM);