Commit 11c99c78 authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f9a8eeb0
...@@ -2776,7 +2776,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0) ...@@ -2776,7 +2776,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|| s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc || h->cur_chroma_format_idc != h->sps.chroma_format_idc
|| av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))); || 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_width = h->sps.mb_width;
s->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); s->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment