Commit 63b8d414 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/bmp: Use ff_set_dimensions()

Fixes out of memory

Fixes: 1282/clusterfuzz-testcase-minimized-5400131681648640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 28b24670
...@@ -133,8 +133,11 @@ static int bmp_decode_frame(AVCodecContext *avctx, ...@@ -133,8 +133,11 @@ static int bmp_decode_frame(AVCodecContext *avctx,
alpha = bytestream_get_le32(&buf); alpha = bytestream_get_le32(&buf);
} }
avctx->width = width; ret = ff_set_dimensions(avctx, width, height > 0 ? height : -(unsigned)height);
avctx->height = height > 0 ? height : -(unsigned)height; if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions %d %d\n", width, height);
return AVERROR_INVALIDDATA;
}
avctx->pix_fmt = AV_PIX_FMT_NONE; avctx->pix_fmt = AV_PIX_FMT_NONE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment