From ff499157a11046a59f88646a2541bd6c170f1804 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 26 Apr 2012 10:59:05 -0400 Subject: [PATCH 1/6] avformat: remove a workaround for broken timestamps This modifies pts in situations other than what was intended, leading to invalid timestamps. Reverts commit 90bb394dccacd10607153833a0aeba0d970dc8db --- libavformat/utils.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index b167e96854..31708cfaa7 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -985,15 +985,6 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, } } - if(pkt->pts != AV_NOPTS_VALUE && duration){ - int64_t old_diff= FFABS(st->cur_dts - duration - pkt->pts); - int64_t new_diff= FFABS(st->cur_dts - pkt->pts); - if(old_diff < new_diff && old_diff < (duration>>3)){ - pkt->pts += duration; - // av_log(NULL, AV_LOG_DEBUG, "id:%d old:%"PRId64" new:%"PRId64" dur:%d cur:%"PRId64" size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size); - } - } - /* presentation is not delayed : PTS and DTS are the same */ if(pkt->pts == AV_NOPTS_VALUE) pkt->pts = pkt->dts; From 8916f1fbcba0f2a3927752ddd0b6ea6e209c6698 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 26 Apr 2012 11:02:02 -0400 Subject: [PATCH 2/6] avformat: only fill-in interpolated timestamps if duration is non-zero This avoids returning duplicate timestamps for multiple packets when the demuxer does not provide all timestamps and packet duration is not known. --- libavformat/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 31708cfaa7..e867b73017 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -985,6 +985,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, } } + if (pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || + duration) { /* presentation is not delayed : PTS and DTS are the same */ if(pkt->pts == AV_NOPTS_VALUE) pkt->pts = pkt->dts; @@ -994,6 +996,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, pkt->dts = pkt->pts; if(pkt->pts != AV_NOPTS_VALUE) st->cur_dts = pkt->pts + duration; + } } } From e5356ebf2216918ad6351d4caa8b58c881c4b0ea Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 26 Apr 2012 11:07:41 -0400 Subject: [PATCH 3/6] cosmetics: indentation --- libavformat/utils.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index e867b73017..658da8f951 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -987,15 +987,16 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, if (pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || duration) { - /* presentation is not delayed : PTS and DTS are the same */ - if(pkt->pts == AV_NOPTS_VALUE) - pkt->pts = pkt->dts; - update_initial_timestamps(s, pkt->stream_index, pkt->pts, pkt->pts); - if(pkt->pts == AV_NOPTS_VALUE) - pkt->pts = st->cur_dts; - pkt->dts = pkt->pts; - if(pkt->pts != AV_NOPTS_VALUE) - st->cur_dts = pkt->pts + duration; + /* presentation is not delayed : PTS and DTS are the same */ + if (pkt->pts == AV_NOPTS_VALUE) + pkt->pts = pkt->dts; + update_initial_timestamps(s, pkt->stream_index, pkt->pts, + pkt->pts); + if (pkt->pts == AV_NOPTS_VALUE) + pkt->pts = st->cur_dts; + pkt->dts = pkt->pts; + if (pkt->pts != AV_NOPTS_VALUE) + st->cur_dts = pkt->pts + duration; } } } From 58b2e0f0f2fc96c1158e04f8aba95cbe6157a1a3 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 23 Apr 2012 13:16:33 +0100 Subject: [PATCH 4/6] vqavideo: return error if image size is not a multiple of block size The decoder assumes in various places that the image size is a multiple of the block size, and there is no obvious way to support odd sizes. Bailing out early if the header specifies a bad size avoids various errors later on. Fixes CVE-2012-0947. Signed-off-by: Mans Rullgard --- libavcodec/vqavideo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 9cca3e743d..dc58b60004 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -151,6 +151,12 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx) return -1; } + if (s->width & (s->vector_width - 1) || + s->height & (s->vector_height - 1)) { + av_log(avctx, AV_LOG_ERROR, "Image size not multiple of block size\n"); + return AVERROR_INVALIDDATA; + } + /* allocate codebooks */ s->codebook_size = MAX_CODEBOOK_SIZE; s->codebook = av_malloc(s->codebook_size); From c02efacc8fd7b3758bf362712019decc907bb8e9 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 3 May 2012 19:14:16 +0100 Subject: [PATCH 5/6] arm: intreadwrite: revert 16-bit load asm to old version for gcc < 4.6 Commit adebad0 "arm: intreadwrite: fix inline asm constraints for gcc 4.6 and later" caused some older gcc versions to miscompile code. This reverts to the old version of the code for these compilers. Signed-off-by: Mans Rullgard --- libavutil/arm/intreadwrite.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h index 86b93c940c..ed53330e39 100644 --- a/libavutil/arm/intreadwrite.h +++ b/libavutil/arm/intreadwrite.h @@ -30,7 +30,9 @@ static av_always_inline unsigned AV_RN16(const void *p) { const uint8_t *q = p; unsigned v; -#ifdef __thumb__ +#if !AV_GCC_VERSION_AT_LEAST(4,6) + __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)q)); +#elif defined __thumb__ __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1])); #else __asm__ ("ldrh %0, %1" : "=r"(v) : "Uq"(q[0]), "m"(q[1])); From 313f9fbfbb5a45eefe4bfe7b04e6c83f9b5f77c7 Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Fri, 27 Apr 2012 14:47:58 +0100 Subject: [PATCH 6/6] configure: add POWER[5-7] support Also merge POWER3 and POWER4 configuration together with the additions. Signed-off-by: Mans Rullgard --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index fd72f1e8a6..b571a94eb5 100755 --- a/configure +++ b/configure @@ -2279,9 +2279,12 @@ elif enabled ppc; then 74*|ppc74*|powerpc74*) cpuflags="-mcpu=7400 -mpowerpc-gfxopt" ;; - g5|970|ppc970|powerpc970|power4*) + g5|970|ppc970|powerpc970) cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" ;; + power[3-7]*) + cpuflags="-mcpu=$cpu -mpowerpc-gfxopt -mpowerpc64" + ;; cell) cpuflags="-mcpu=cell" enable ldbrx