diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-03-18 16:42:32 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-03-18 21:19:09 +0100 |
commit | 0ca15aa066f1fad20853f5a560f13688d095ea81 (patch) | |
tree | 82c83aa67212d53b832bd02fe5efe74ba93e552c /libavcodec/jpeglsenc.c | |
parent | a41340f8e85a13ec0b5a8a6bb93d09342adac047 (diff) | |
download | ffmpeg-0ca15aa066f1fad20853f5a560f13688d095ea81.tar.gz |
lavc/jpeglsenc: fix allocation in case of negative linesize, and add malloc check
Fix crash with negative linesizes, fix trac ticket #1078.
Diffstat (limited to 'libavcodec/jpeglsenc.c')
-rw-r--r-- | libavcodec/jpeglsenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c index 62a2328a0a..aff1c6dd82 100644 --- a/libavcodec/jpeglsenc.c +++ b/libavcodec/jpeglsenc.c @@ -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){ |