History

avformat/pcm: Use 64bit in bitrate computation

Fixes: signed integer overflow: 65792 * 65312 cannot be represented in type 'int' Fixes: 67819/clusterfuzz-testcase-minimized-ffmpeg_dem_WADY_fuzzer-5236100912185344

Michael Niedermayer committed 2 years ago

Commit bf3b7411 parent ed493911 file · +1 −1Browse files

Unified · Split

libavformat/pcm.c+1−1
@@ -41,7 +41,7 @@ int ff_pcm_default_packet_size(AVCodecParameters *par) · 40 unmodified lines
4141 /* Don't trust the codecpar bitrate if we can calculate it ourselves */
4242 if (bits_per_sample > 0 && par->sample_rate > 0 && par->ch_layout.nb_channels > 0)
4343 if ((int64_t)par->sample_rate * par->ch_layout.nb_channels < INT64_MAX / bits_per_sample)
44− bitrate = bits_per_sample * par->sample_rate * par->ch_layout.nb_channels;
44+ bitrate = bits_per_sample * (int64_t)par->sample_rate * par->ch_layout.nb_channels;
4545
4646 if (bitrate > 0) {
4747 nb_samples = av_clip64(bitrate / 8 / PCM_DEMUX_TARGET_FPS / par->block_align, 1, max_samples);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t