mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/qsvdec: Check av_image_get_buffer_size() for failure
Fixes: CID1477406 Improper use of negative value
Sponsored-by: Sovereign Tech Fund
Reviewed-by: "Xiang, Haihao" <haihao.xiang@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8789c550fa
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
749a3cdae8
commit
52f7861420
|
@ -248,9 +248,12 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, mfxVideoParam *
|
||||||
|
|
||||||
q->frame_info = param->mfx.FrameInfo;
|
q->frame_info = param->mfx.FrameInfo;
|
||||||
|
|
||||||
if (!avctx->hw_frames_ctx)
|
if (!avctx->hw_frames_ctx) {
|
||||||
q->pool = av_buffer_pool_init(av_image_get_buffer_size(avctx->pix_fmt,
|
ret = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 128), FFALIGN(avctx->height, 64), 1);
|
||||||
FFALIGN(avctx->width, 128), FFALIGN(avctx->height, 64), 1), av_buffer_allocz);
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
q->pool = av_buffer_pool_init(ret, av_buffer_allocz);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue