mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avcodec/msvideo1enc: Add check for av_malloc
Add the check for the return value of the av_malloc in order to avoid NULL pointer deference. Fixes: e4be3485af ("MS Video 1 encoder") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
This commit is contained in:
parent
f8d0b13de5
commit
b9ba036680
@ -84,6 +84,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
if(!c->prev)
|
||||
c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));
|
||||
if (!c->prev)
|
||||
return AVERROR(ENOMEM);
|
||||
prevptr = c->prev + avctx->width * 3 * (FFALIGN(avctx->height, 4) - 1);
|
||||
src = (const uint16_t*)(p->data[0] + p->linesize[0]*(FFALIGN(avctx->height, 4) - 1));
|
||||
if(c->keyint >= avctx->keyint_min)
|
||||
|
Loading…
x
Reference in New Issue
Block a user