aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-23 19:11:03 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:21 +0200
commit09ffdfbd68e58791c233f4aa523d55670e65dfbf (patch)
treeb59da75c05a9e3fb6a1382f3b20833a8c6daad9b /libavformat
parentd678a0e492f09fd158a4f42a0ce24cadb1546ad4 (diff)
downloadffmpeg-09ffdfbd68e58791c233f4aa523d55670e65dfbf.tar.gz
avformat/avidec: fix position overflow in avi_load_index()
Fixes: signed integer overflow: 9223372033098784808 + 4294967072 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6732488912273408 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 527821a2dd6f19d9a4d2abe05833346ae86c66c6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avidec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 2e49fbeca1..d24f36fa14 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1755,7 +1755,10 @@ static int avi_load_index(AVFormatContext *s)
size = avio_rl32(pb);
if (avio_feof(pb))
break;
- next = avio_tell(pb) + size + (size & 1);
+ next = avio_tell(pb);
+ if (next < 0 || next > INT64_MAX - size - (size & 1))
+ break;
+ next += size + (size & 1LL);
av_log(s, AV_LOG_TRACE, "tag=%c%c%c%c size=0x%x\n",
tag & 0xff,