summaryrefslogtreecommitdiff
path: root/libavcodec/ljpegenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-05 18:52:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-05 18:52:07 +0100
commitc2dd5a18b27bb33d871d41fbed9104f3a68d68fe (patch)
tree55210bacf58fe25a54222c024f11f09cf8fb4619 /libavcodec/ljpegenc.c
parenta8343bfb6a3f00777943b94ff2969422f578f246 (diff)
downloadffmpeg-c2dd5a18b27bb33d871d41fbed9104f3a68d68fe.tar.gz
ljpegenc: allocate needed scratch-buffer
Fixes null pointer dereference Fixes Ticket2207 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ljpegenc.c')
-rw-r--r--libavcodec/ljpegenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index d3c292123e..0ab4985c10 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -57,6 +57,13 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
max_pkt_size += mb_width * mb_height * 3 * 4
* s->mjpeg_hsample[0] * s->mjpeg_vsample[0];
}
+
+ if (!s->edge_emu_buffer &&
+ (ret = ff_mpv_frame_size_alloc(s, pict->linesize[0])) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "failed to allocate context scratch buffers.\n");
+ return ret;
+ }
+
if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0)
return ret;