[FFmpeg-cvslog] mjpeg: initialize input padding after unescaped buffer to zero

Janne Grunau git at videolan.org
Sun Dec 9 14:01:52 CET 2012


ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Sat Dec  8 16:20:18 2012 +0100| [6a1aa5cb26479eda12320e9b9ced9cc058bf5b33] | committer: Janne Grunau

mjpeg: initialize input padding after unescaped buffer to zero

Fixes valgrind --undef-value-errors=yes warnings caused by valid
overreads in the fate vsynth jpegls, cover-art-ape and cover-art-wv
tests.

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

 libavcodec/mjpegdec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 104a63d..0b22bca 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1387,6 +1387,8 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
         }
         *unescaped_buf_ptr  = s->buffer;
         *unescaped_buf_size = dst - s->buffer;
+        memset(s->buffer + *unescaped_buf_size, 0,
+               FF_INPUT_BUFFER_PADDING_SIZE);
 
         av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
                (buf_end - *buf_ptr) - (dst - s->buffer));
@@ -1428,6 +1430,8 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
 
         *unescaped_buf_ptr  = dst;
         *unescaped_buf_size = (bit_count + 7) >> 3;
+        memset(s->buffer + *unescaped_buf_size, 0,
+               FF_INPUT_BUFFER_PADDING_SIZE);
     } else {
         *unescaped_buf_ptr  = *buf_ptr;
         *unescaped_buf_size = buf_end - *buf_ptr;



More information about the ffmpeg-cvslog mailing list