Commit 60e95747 authored by Michael Niedermayer's avatar Michael Niedermayer

rawdec: check avpicture_get_size() return value

Fixes CID205019
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent d3de3a16
...@@ -113,11 +113,15 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) ...@@ -113,11 +113,15 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
avctx->pix_fmt==AV_PIX_FMT_PAL8 && avctx->pix_fmt==AV_PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
context->length = avpicture_get_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height); context->length = avpicture_get_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height);
if (context->length < 0)
return context->length;
context->buffer = av_malloc(context->length); context->buffer = av_malloc(context->length);
if (!context->buffer) if (!context->buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} else { } else {
context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if (context->length < 0)
return context->length;
} }
context->pic.pict_type = AV_PICTURE_TYPE_I; context->pic.pict_type = AV_PICTURE_TYPE_I;
context->pic.key_frame = 1; context->pic.key_frame = 1;
......
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