lavc/jpeglsenc: fix allocation in case of negative linesize, and add malloc check

Fix crash with negative linesizes, fix trac ticket #1078.
This commit is contained in:
Stefano Sabatini 2012-03-18 16:42:32 +01:00
parent a41340f8e8
commit 0ca15aa066
1 changed files with 3 additions and 1 deletions

View File

@ -295,7 +295,9 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
ls_store_lse(state, &pb);
zero = av_mallocz(p->linesize[0]);
zero = av_mallocz(FFABS(p->linesize[0]));
if (!zero)
return AVERROR(ENOMEM);
last = zero;
cur = p->data[0];
if(avctx->pix_fmt == PIX_FMT_GRAY8){