avformat/lafdec: Check for 0 parameters

Fixes: Timeout
Fixes: 63661/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-6615365234589696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-11-03 00:33:41 +01:00
parent 03a4aa9699
commit 4fb9d94688
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 3 additions and 1 deletions

View File

@ -139,7 +139,9 @@ static int laf_read_header(AVFormatContext *ctx)
s->index = 0;
s->stored_index = 0;
s->bpp = bpp;
if ((int64_t)bpp * st_count * (int64_t)sample_rate >= INT32_MAX)
if ((int64_t)bpp * st_count * (int64_t)sample_rate >= INT32_MAX ||
(int64_t)bpp * st_count * (int64_t)sample_rate == 0
)
return AVERROR_INVALIDDATA;
s->data = av_calloc(st_count * sample_rate, bpp);
if (!s->data)