Commit 0ca15aa0 authored by Stefano Sabatini's avatar Stefano Sabatini

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

Fix crash with negative linesizes, fix trac ticket #1078.
parent a41340f8
......@@ -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){
......
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