mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-25 04:09:57 +00:00
h264: reset first_field if frame_start() fails for missing refs
In this case we may not have a current frame, while first_field being set implies we do. Fixes invalid reads. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
This commit is contained in:
parent
210881110d
commit
d1b3fabe69
@ -3619,8 +3619,11 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
|
av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
|
||||||
h->frame_num, h->prev_frame_num);
|
h->frame_num, h->prev_frame_num);
|
||||||
ret = h264_frame_start(h);
|
ret = h264_frame_start(h);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
h0->first_field = 0;
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
h->prev_frame_num++;
|
h->prev_frame_num++;
|
||||||
h->prev_frame_num %= 1 << h->sps.log2_max_frame_num;
|
h->prev_frame_num %= 1 << h->sps.log2_max_frame_num;
|
||||||
h->cur_pic_ptr->frame_num = h->prev_frame_num;
|
h->cur_pic_ptr->frame_num = h->prev_frame_num;
|
||||||
|
Loading…
Reference in New Issue
Block a user