diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2012-08-24 22:10:19 -0400 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2012-08-24 22:19:21 -0400 |
commit | aa7a5651019a2c603aff2c265777206ef4da742a (patch) | |
tree | 7c4ef6f0ac9465dce1d5ed57aeb6e94208120ee3 | |
parent | 01cb4c84f54a52725c9b4b4dd6c609c36cccc5d4 (diff) | |
download | ffmpeg-aa7a5651019a2c603aff2c265777206ef4da742a.tar.gz |
cllc: Pad swapped buffer
The bitstream buffer must be padded, or the bitstream reader might
read over the end.
Fixes the following valgrind warning:
Use of uninitialised value of size 8 at 0x591BAE: cllc_decode_frame (cllc.c:166)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r-- | libavcodec/cllc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c index a1514179b7..d1beb7efa1 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -284,7 +284,8 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, /* Make sure our bswap16'd buffer is big enough */ swapped_buf_new = av_fast_realloc(ctx->swapped_buf, - &ctx->swapped_buf_size, avpkt->size); + &ctx->swapped_buf_size, avpkt->size + + FF_INPUT_BUFFER_PADDING_SIZE); if (!swapped_buf_new) { av_log(avctx, AV_LOG_ERROR, "Could not realloc swapped buffer.\n"); return AVERROR(ENOMEM); @@ -313,6 +314,10 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, ctx->dsp.bswap16_buf((uint16_t *) ctx->swapped_buf, (uint16_t *) src, (avpkt->size - info_offset) / 2); + /* Initialize padding to 0 */ + memset(ctx->swapped_buf + avpkt->size - info_offset, + 0, FF_INPUT_BUFFER_PADDING_SIZE); + init_get_bits(&gb, ctx->swapped_buf, (avpkt->size - info_offset) * 8); /* |