Skip to content

Commit

Permalink
avformat/rpl: Use 64bit in bitrate computation and check it
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
michaelni committed Jun 5, 2021
1 parent ff0d70c commit 29b244f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libavformat/rpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,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) {
Expand Down

0 comments on commit 29b244f

Please sign in to comment.