aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-07 03:34:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-13 20:48:08 +0100
commit4d5beea7a1820289e211345db06ba185d51772d8 (patch)
tree28cc0b3b57efca4be18a9b7f207e6170b737e208 /libavcodec
parent2073ab266eef2c01bd750f20d1177db4ca71ea63 (diff)
downloadffmpeg-4d5beea7a1820289e211345db06ba185d51772d8.tar.gz
avcodec/h264_slice: ignore SAR changes in slices after the first
Fixes race condition and null pointer dereference Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 38d5241b7f36c1571a88517a0650caade16dd5f4) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264_slice.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 113bcc31ec..641ec23af4 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1431,13 +1431,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|| 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height
|| h->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, h->avctx->sample_aspect_ratio)
|| h->mb_width != h->sps.mb_width
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
));
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
must_reinit = 1;
+ if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
+ must_reinit = 1;
+
h->mb_width = h->sps.mb_width;
h->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
h->mb_num = h->mb_width * h->mb_height;