aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-29 04:17:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-29 04:40:04 +0100
commit11c99c78bafa77f679a1a3ba06ad00984b9a4cae (patch)
tree03cfcf163ca94fdab5069c9141cde99d2ab9d056
parentf9a8eeb08c4ccfd0678047e64b0f616ae1379c27 (diff)
downloadffmpeg-11c99c78bafa77f679a1a3ba06ad00984b9a4cae.tar.gz
h264: check the pixel format directly and force a reinit on mismatches.
The existing checks are insufficient to detect a pixel format changes in case of some damaged streams. Fixes inconsistency and later out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/h264.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8436032b18..a3f8db294c 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2776,7 +2776,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|| s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc
|| av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio)));
-
+ if (h0->s.avctx->pix_fmt != get_pixel_format(h0))
+ must_reinit = 1;
s->mb_width = h->sps.mb_width;
s->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);