diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-16 18:04:18 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-16 18:04:22 +0200 |
commit | 776fb2e10d4a4f0bc3fc6b46d1e74e358ec64556 (patch) | |
tree | a4904a9affc839fca9da375098e2587c813846bc | |
parent | 09a278fdd13cfc16c151190051f362625595c06e (diff) | |
parent | 0dfcbe5285f04964f5de5e15a4bfbf83fb9fd082 (diff) | |
download | ffmpeg-776fb2e10d4a4f0bc3fc6b46d1e74e358ec64556.tar.gz |
Merge remote-tracking branch 'qatar/release/0.5' into release/0.5
* qatar/release/0.5:
lavfi: avfilter_merge_formats: handle case where inputs are same
mpegvideo: Don't use ff_mspel_motion() for vc1
imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
nuv: check RTjpeg header for validity
vc1dec: add flush function for WMV9 and VC-1 decoders
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/imgconvert.c | 3 | ||||
-rw-r--r-- | libavcodec/mpegvideo_common.h | 2 | ||||
-rw-r--r-- | libavcodec/nuv.c | 9 | ||||
-rw-r--r-- | libavcodec/rtjpeg.h | 3 | ||||
-rw-r--r-- | libavcodec/vc1.c | 2 | ||||
-rw-r--r-- | libavfilter/formats.c | 3 |
6 files changed, 16 insertions, 6 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 1e0c66de84..eecd12535e 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -890,7 +890,8 @@ static int avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask, /* find exact color match with smallest size */ dst_pix_fmt = -1; min_dist = 0x7fffffff; - for(i = 0;i < PIX_FMT_NB; i++) { + /* test only the first 64 pixel formats to avoid undefined behaviour */ + for (i = 0; i < 64; i++) { if (pix_fmt_mask & (1ULL << i)) { loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask; if (loss == 0) { diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_common.h index cf66dc7fbb..6c39ac7325 100644 --- a/libavcodec/mpegvideo_common.h +++ b/libavcodec/mpegvideo_common.h @@ -727,7 +727,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, 0, 0, 0, ref_picture, pix_op, qpix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); - }else if(!is_mpeg12 && CONFIG_WMV2 && s->mspel){ + }else if(!is_mpeg12 && CONFIG_WMV2 && s->mspel && s->codec_id == CODEC_ID_WMV2){ ff_mspel_motion(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index 109ef41a8c..64ba3ccc10 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -182,17 +182,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, } if (c->codec_frameheader) { int w, h, q; - if (buf_size < 12) { + if (buf_size < RTJPEG_HEADER_SIZE || buf[4] != RTJPEG_HEADER_SIZE || + buf[5] != RTJPEG_FILE_VERSION) { av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n"); - return -1; + return AVERROR_INVALIDDATA; } w = AV_RL16(&buf[6]); h = AV_RL16(&buf[8]); q = buf[10]; if (!codec_reinit(avctx, w, h, q)) return -1; - buf = &buf[12]; - buf_size -= 12; + buf = &buf[RTJPEG_HEADER_SIZE]; + buf_size -= RTJPEG_HEADER_SIZE; } if (keyframe && c->pic.data[0]) diff --git a/libavcodec/rtjpeg.h b/libavcodec/rtjpeg.h index 02f2058b2c..c12a78c67b 100644 --- a/libavcodec/rtjpeg.h +++ b/libavcodec/rtjpeg.h @@ -25,6 +25,9 @@ #include <stdint.h> #include "dsputil.h" +#define RTJPEG_FILE_VERSION 0 +#define RTJPEG_HEADER_SIZE 12 + typedef struct { int w, h; DSPContext *dsp; diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 619e9030cb..3b8cd22933 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -4347,6 +4347,7 @@ AVCodec vc1_decoder = { vc1_decode_frame, CODEC_CAP_DELAY, NULL, + .flush = ff_mpeg_flush, .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), .pix_fmts = ff_pixfmt_list_420 }; @@ -4362,6 +4363,7 @@ AVCodec wmv3_decoder = { vc1_decode_frame, CODEC_CAP_DELAY, NULL, + .flush = ff_mpeg_flush, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"), .pix_fmts = ff_pixfmt_list_420 }; diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 33fec163a5..c91f8b2cf8 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -43,6 +43,9 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) AVFilterFormats *ret; unsigned i, j, k = 0; + if (a == b) + return a; + ret = av_mallocz(sizeof(AVFilterFormats)); /* merge list of formats */ |