Message ID | 20220317233019.12049-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | b59ea948cdcb8422964595c32076312756550f17 |
Headers | show |
Series | [FFmpeg-devel,1/3] avcodec/dfpwmdec: Check packet size more completely | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
lgtm
On Fri, Mar 18, 2022 at 09:31:27AM +0100, Paul B Mahol wrote:
> lgtm
will apply
thx
[...]
diff --git a/libavcodec/dfpwmdec.c b/libavcodec/dfpwmdec.c index 27b60a4ea4..e11f393ee4 100644 --- a/libavcodec/dfpwmdec.c +++ b/libavcodec/dfpwmdec.c @@ -106,7 +106,10 @@ static int dfpwm_dec_frame(struct AVCodecContext *ctx, void *data, AVFrame *frame = data; int ret; - frame->nb_samples = packet->size * 8 / ctx->ch_layout.nb_channels; + if (packet->size * 8LL % ctx->ch_layout.nb_channels) + return AVERROR_PATCHWELCOME; + + frame->nb_samples = packet->size * 8LL / ctx->ch_layout.nb_channels; if (frame->nb_samples <= 0) { av_log(ctx, AV_LOG_ERROR, "invalid number of samples in packet\n"); return AVERROR_INVALIDDATA;
Fixes: out of array access Fixes: 45497/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFPWM_fuzzer-5239786212818944.fuzz Fixes: 45510/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFPWM_fuzzer-4947856883056640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/dfpwmdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)