diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-30 04:51:09 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-03 01:04:18 +0200 |
commit | bb4126e250e0a2d8505d135cd81d8c98b48dd4fc (patch) | |
tree | 77ee2596bf768754f8beb0b3f84173863cfca1c2 /libavcodec | |
parent | 9902eef0f5314b112938de6c32daaa7771daeb57 (diff) | |
download | ffmpeg-bb4126e250e0a2d8505d135cd81d8c98b48dd4fc.tar.gz |
ffv1dec: check that global parameters dont change in version 0/1
Such changes are not allowed nor supported
Fixes Ticket2906
Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 547d690d676064069d44703a1917e0dab7e33445)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/ffv1dec.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 60bbbd0375..b72e3125c0 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -527,6 +527,7 @@ static int read_header(FFV1Context *f) memset(state, 128, sizeof(state)); if (f->version < 2) { + int chroma_planes, chroma_h_shift, chroma_v_shift, transparency; unsigned v= get_symbol(c, state, 0); if (v >= 2) { av_log(f->avctx, AV_LOG_ERROR, "invalid version %d in ver01 header\n", v); @@ -544,10 +545,26 @@ static int read_header(FFV1Context *f) if (f->version > 0) f->avctx->bits_per_raw_sample = get_symbol(c, state, 0); - f->chroma_planes = get_rac(c, state); - f->chroma_h_shift = get_symbol(c, state, 0); - f->chroma_v_shift = get_symbol(c, state, 0); - f->transparency = get_rac(c, state); + chroma_planes = get_rac(c, state); + chroma_h_shift = get_symbol(c, state, 0); + chroma_v_shift = get_symbol(c, state, 0); + transparency = get_rac(c, state); + + if (f->plane_count) { + if ( chroma_planes != f->chroma_planes + || chroma_h_shift!= f->chroma_h_shift + || chroma_v_shift!= f->chroma_v_shift + || transparency != f->transparency) { + av_log(f->avctx, AV_LOG_ERROR, "Invalid change of global parameters\n"); + return AVERROR_INVALIDDATA; + } + } + + f->chroma_planes = chroma_planes; + f->chroma_h_shift = chroma_h_shift; + f->chroma_v_shift = chroma_v_shift; + f->transparency = transparency; + f->plane_count = 2 + f->transparency; } |