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/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-05-01 17:53:11 +02:00
parent 28b2467074
commit 63b8d4146d
1 changed files with 5 additions and 2 deletions

View File

@ -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;