1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/pcm: Check block_align

Fixes: signed integer overflow: 321 * 8746632 cannot be represented in type 'int'
Fixes: 26461/clusterfuzz-testcase-minimized-ffmpeg_dem_PVF_fuzzer-6326427831762944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-10-20 21:44:32 +02:00
parent 80bc2ac3c0
commit b23a619c13

View File

@ -39,7 +39,11 @@ int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
* Clamp to RAW_SAMPLES if larger. * Clamp to RAW_SAMPLES if larger.
*/ */
size = FFMAX(par->sample_rate/25, 1); size = FFMAX(par->sample_rate/25, 1);
size = FFMIN(size, RAW_SAMPLES) * par->block_align; if (par->block_align <= INT_MAX / RAW_SAMPLES) {
size = FFMIN(size, RAW_SAMPLES) * par->block_align;
} else {
size = par->block_align;
}
ret = av_get_packet(s->pb, pkt, size); ret = av_get_packet(s->pb, pkt, size);