mirror of https://git.ffmpeg.org/ffmpeg.git
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>
This commit is contained in:
parent
2325490a2f
commit
607a34f726
|
@ -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…
Reference in New Issue