summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-04 21:01:46 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-04-05 18:41:59 +0200
commit0f6a3405e8987ad761a2d9139fdc95bbb6a61118 (patch)
treef7e4d1a6538b26857542e1b4cf217d9f993a83a3
parent9b6ffcf0fd61b61e53591c0ce215de2ce35a6982 (diff)
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>
-rw-r--r--libavformat/mov.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 7805330bf9..8d19824910 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7114,7 +7114,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) {
@@ -7161,6 +7161,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) {