diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-04-04 21:01:46 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-04-08 22:55:16 +0200 |
commit | d22550dd61003ffefc1a7738b2c14916083116a9 (patch) | |
tree | 73d3481b981687c9897c690572111045584b29b6 | |
parent | 2a7f1bc282ddebee296bc0ca48a85bf01b626b3b (diff) | |
download | ffmpeg-d22550dd61003ffefc1a7738b2c14916083116a9.tar.gz |
avformat/mov: check offset for overflow in mov_probe()
Fixes: Invalid read of size 4
Fixes: ASAN_Deadlysignal.zip
Found-by: Hardik Shah <hardik05@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0f6a3405e8987ad761a2d9139fdc95bbb6a61118)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mov.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 50234f3b5f..38a70589be 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7122,7 +7122,7 @@ static int mov_probe(const AVProbeData *p) int64_t size; int minsize = 8; /* ignore invalid offset */ - if ((offset + 8) > (unsigned int)p->buf_size) + if ((offset + 8ULL) > (unsigned int)p->buf_size) break; size = AV_RB32(p->buf + offset); if (size == 1 && offset + 16 <= (unsigned int)p->buf_size) { @@ -7169,6 +7169,8 @@ static int mov_probe(const AVProbeData *p) score = FFMAX(score, AVPROBE_SCORE_EXTENSION); break; } + if (size > INT64_MAX - offset) + break; offset += size; } if (score > AVPROBE_SCORE_MAX - 50 && moov_offset != -1) { |