From 54c7fe6d68444cc3c5d4fdda2f2126ed79eac855 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 1 Dec 2012 23:42:11 +0100 Subject: [PATCH 1/4] raw demuxer: initialize end of partial packets --- libavformat/rawdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 1c9aabd6fd..5e95d10efd 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -45,6 +45,10 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) { av_free_packet(pkt); return ret; + } else if (ret < size) { + /* initialize end of packet for partial reads to avoid reading + * uninitialized data on allowed overreads */ + memset(pkt->data + ret, 0, FF_INPUT_BUFFER_PADDING_SIZE); } pkt->size = ret; return ret; From 42060c703011d742661c3f5df66b6f30358acd96 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 2 Dec 2012 22:09:36 +0100 Subject: [PATCH 2/4] eamad: initialize padding of bitstream_buf through av_fast_padded_malloc() --- libavcodec/eamad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 9f4d85878a..cf44ae98e3 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -264,7 +264,8 @@ static int decode_frame(AVCodecContext *avctx, } } - av_fast_malloc(&s->bitstream_buf, &s->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_padded_malloc(&s->bitstream_buf, &s->bitstream_buf_size, + buf_end - buf); if (!s->bitstream_buf) return AVERROR(ENOMEM); s->dsp.bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2); From c15fea7933b3801962851a37c3ef00ce968431c4 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 2 Dec 2012 22:15:42 +0100 Subject: [PATCH 3/4] mimic: initialize padding of swap_buf through av_fast_padded_malloc --- libavcodec/mimic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 8e35f9228c..95695de34c 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -370,8 +370,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ff_thread_finish_setup(avctx); - av_fast_malloc(&ctx->swap_buf, &ctx->swap_buf_size, - swap_buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_padded_malloc(&ctx->swap_buf, &ctx->swap_buf_size, swap_buf_size); if(!ctx->swap_buf) return AVERROR(ENOMEM); From da025d115a1ada58081cd869e85b81a1c183ae9e Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 4 Dec 2012 15:53:01 +0000 Subject: [PATCH 4/4] fate: workaround for slighly broken 'test' shell builtin Some shells, e.g. minix3, have a broken 'test' builtin which fails if the first operand of a binary operator looks like a unary operator. Prefixing the values with 'x' prevents this from happening. Signed-off-by: Mans Rullgard --- tests/fate-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index cc6c4d1015..d1633e8be4 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -78,7 +78,7 @@ avconv(){ dec_opts="-threads $threads -thread_type $thread_type" avconv_args="-nostats -cpuflags $cpuflags" for arg in $@; do - [ ${arg} = -i ] && avconv_args="${avconv_args} ${dec_opts}" + [ x${arg} = x-i ] && avconv_args="${avconv_args} ${dec_opts}" avconv_args="${avconv_args} ${arg}" done run avconv ${avconv_args}