diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-08 12:29:47 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-16 16:03:24 +0200 |
commit | 0df90898f5a3cbbb8c664a05d69c29655ccf0a80 (patch) | |
tree | 8134cf638f4d2e918c80eb138b86607ef604311a | |
parent | 67a4811c88c4eaa5503cf6abea27a0e64afb6a65 (diff) | |
download | ffmpeg-0df90898f5a3cbbb8c664a05d69c29655ccf0a80.tar.gz |
avcodec/h264_slice: Dont reset mb_aff_frame per slice
Fixes null pointer dereference
Fixes Ticket4440
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 386601286fed2dff5e1955bc21a0256f6f35ab19)
Conflicts:
libavcodec/h264_slice.c
(cherry picked from commit ce6d38e9ed0842870f3cd5414937bb6d1f2417d9)
Conflicts:
libavcodec/h264_slice.c
-rw-r--r-- | libavcodec/h264.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 61fd02fd96..f17304eaeb 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3512,6 +3512,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) int field_pic_flag, bottom_field_flag; int first_slice = h == h0 && !h0->current_slice; int frame_num, picture_structure, droppable; + int mb_aff_frame, last_mb_aff_frame; PPS *pps; h->me.qpel_put = h->h264qpel.put_h264_qpel_pixels_tab; @@ -3727,7 +3728,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0) } h->mb_mbaff = 0; - h->mb_aff_frame = 0; + mb_aff_frame = 0; + last_mb_aff_frame = h0->mb_aff_frame; last_pic_structure = h0->picture_structure; last_pic_droppable = h0->droppable; droppable = h->nal_ref_idc == 0; @@ -3745,12 +3747,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0) picture_structure = PICT_TOP_FIELD + bottom_field_flag; } else { picture_structure = PICT_FRAME; - h->mb_aff_frame = h->sps.mb_aff; + mb_aff_frame = h->sps.mb_aff; } } if (h0->current_slice) { if (last_pic_structure != picture_structure || - last_pic_droppable != droppable) { + last_pic_droppable != droppable || + last_mb_aff_frame != mb_aff_frame) { av_log(h->avctx, AV_LOG_ERROR, "Changing field mode (%d -> %d) between slices is not allowed\n", last_pic_structure, h->picture_structure); @@ -3766,6 +3769,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) h->picture_structure = picture_structure; h->droppable = droppable; h->frame_num = frame_num; + h->mb_aff_frame = mb_aff_frame; h->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (h0->current_slice == 0) { |