aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-09 14:51:03 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-09 14:52:15 +0100
commit5763f675024765df8f256d8b5b01926a5fbd997d (patch)
tree183ba69a9ac8d4e88d251bd79f51104aea436976
parentb74ecb82fa51aba52a95992668546afe8ed2bd9f (diff)
downloadffmpeg-5763f675024765df8f256d8b5b01926a5fbd997d.tar.gz
avformat/mov: Check dimensions before setting aspect
Fixes division by 0 Fixes: asan_heap-uaf_143f420_728_cov_1441472032_HDV_0113.MP4 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mov.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index e5dd1bd3fa..52b6728544 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2630,7 +2630,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- if (!st->sample_aspect_ratio.num &&
+ if (!st->sample_aspect_ratio.num && st->codec->width && st->codec->height &&
+ sc->height && sc->width &&
(st->codec->width != sc->width || st->codec->height != sc->height)) {
st->sample_aspect_ratio = av_d2q(((double)st->codec->height * sc->width) /
((double)st->codec->width * sc->height), INT_MAX);