1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.
This commit is contained in:
Janne Grunau 2012-12-08 16:20:18 +01:00
parent 18e6f087c4
commit 6a1aa5cb26

View File

@ -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;