Browse Source

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>
(cherry picked from commit b23a619c13)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.3.2
Michael Niedermayer 5 years ago
parent
commit
e5c9bae371
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      libavformat/pcm.c

+ 5
- 1
libavformat/pcm.c View File

@@ -39,7 +39,11 @@ int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
* Clamp to RAW_SAMPLES if larger.
*/
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);



Loading…
Cancel
Save