aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-12-08 16:20:18 +0100
committerJanne Grunau <janne-libav@jannau.net>2012-12-08 17:05:45 +0100
commit6a1aa5cb26479eda12320e9b9ced9cc058bf5b33 (patch)
treee9a4ebe72b8528c45159ea5d76dff0b6c7dd668c /libavcodec/mjpegdec.c
parent18e6f087c4a50bede8449ee164778945480be50c (diff)
downloadffmpeg-6a1aa5cb26479eda12320e9b9ced9cc058bf5b33.tar.gz
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.
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 104a63d5fd..0b22bca5f3 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;