[FFmpeg-cvslog] ljpegenc: allocate needed scratch-buffer

Michael Niedermayer git at videolan.org
Tue Feb 5 19:01:09 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Feb  5 18:52:07 2013 +0100| [c2dd5a18b27bb33d871d41fbed9104f3a68d68fe] | committer: Michael Niedermayer

ljpegenc: allocate needed scratch-buffer

Fixes null pointer dereference
Fixes Ticket2207

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2dd5a18b27bb33d871d41fbed9104f3a68d68fe
---

 libavcodec/ljpegenc.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index d3c2921..0ab4985 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;
 



More information about the ffmpeg-cvslog mailing list