History

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.

Jiasheng Jiang committed 3 years ago

Commit b9ba0361 parent f8d0b131 file · +2 −0Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/msvideo1enc.c+2−0
@@ -84,6 +84,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 83 unmodified lines
84 84
85 if(!c->prev)85 if(!c->prev)
86 c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));86 c->prev = av_malloc(avctx->width * 3 * (avctx->height + 3));
87 if (!c->prev)
88 return AVERROR(ENOMEM);
87 prevptr = c->prev + avctx->width * 3 * (FFALIGN(avctx->height, 4) - 1);89 prevptr = c->prev + avctx->width * 3 * (FFALIGN(avctx->height, 4) - 1);
88 src = (const uint16_t*)(p->data[0] + p->linesize[0]*(FFALIGN(avctx->height, 4) - 1));90 src = (const uint16_t*)(p->data[0] + p->linesize[0]*(FFALIGN(avctx->height, 4) - 1));
89 if(c->keyint >= avctx->keyint_min)91 if(c->keyint >= avctx->keyint_min)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t