summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9ebfa0bcc7..2aed6e80ef 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -610,11 +610,13 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
for (i = 0; i < entries; i++) {
MOVDref *dref = &sc->drefs[i];
uint32_t size = avio_rb32(pb);
- int64_t next = avio_tell(pb) + size - 4;
+ int64_t next = avio_tell(pb);
- if (size < 12)
+ if (size < 12 || next < 0 || next > INT64_MAX - size)
return AVERROR_INVALIDDATA;
+ next += size - 4;
+
dref->type = avio_rl32(pb);
avio_rb32(pb); // version + flags