diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-04-26 22:43:51 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-09 13:54:52 +0200 |
commit | 97d0d3ae61683b000faa67d1260c4bb33fa42f73 (patch) | |
tree | c3a0135bc20b21233dd815383060683be8aa19b4 | |
parent | d2e90cde299d0ba0cf41287c5ae33f2e9c9900ee (diff) | |
download | ffmpeg-97d0d3ae61683b000faa67d1260c4bb33fa42f73.tar.gz |
avformat/rpl: Use 64bit in bitrate computation and check it
Fixes: signed integer overflow: 777777776 * 4 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-6726188921913344
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 29b244ffc15abe2c24d2145f63048e8b3bdaa303)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/rpl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/rpl.c b/libavformat/rpl.c index df5109dc70..1b91cf4385 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -199,8 +199,10 @@ static int rpl_read_header(AVFormatContext *s) ast->codecpar->bits_per_coded_sample = 4; ast->codecpar->bit_rate = ast->codecpar->sample_rate * - ast->codecpar->bits_per_coded_sample * - ast->codecpar->channels; + (int64_t)ast->codecpar->channels; + if (ast->codecpar->bit_rate > INT64_MAX / ast->codecpar->bits_per_coded_sample) + return AVERROR_INVALIDDATA; + ast->codecpar->bit_rate *= ast->codecpar->bits_per_coded_sample; ast->codecpar->codec_id = AV_CODEC_ID_NONE; switch (audio_format) { |