aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-14 22:08:25 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit737803535f881568d71908ca86fa11b421f32161 (patch)
tree84b2adf7bc90336fef6209a7ca24ab91601cf57f
parent5310bf2493fe15b25748711d63df906cf2e4ba7b (diff)
downloadffmpeg-737803535f881568d71908ca86fa11b421f32161.tar.gz
avformat/lxfdec: Fix multiple integer overflows related to track_size
Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_LXF_fuzzer-6634030636335104 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 7819412f4468514a2bab924291d79806a569388c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/lxfdec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 99e56f243f..55fbb0ac09 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -196,7 +196,7 @@ static int get_packet_header(AVFormatContext *s)
return AVERROR_PATCHWELCOME;
}
- samples = track_size * 8 / st->codecpar->bits_per_coded_sample;
+ samples = track_size * 8LL / st->codecpar->bits_per_coded_sample;
//use audio packet size to determine video standard
//for NTSC we have one 8008-sample audio frame per five video frames
@@ -211,6 +211,8 @@ static int get_packet_header(AVFormatContext *s)
avpriv_set_pts_info(s->streams[0], 64, 1, 25);
}
+ if (av_popcount(channels) * (uint64_t)track_size > INT_MAX)
+ return AVERROR_INVALIDDATA;
//TODO: warning if track mask != (1 << channels) - 1?
ret = av_popcount(channels) * track_size;