diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-12-18 11:29:25 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-12-19 08:15:58 +0100 |
commit | 45286a625c6ced1f5c4c842244cbb4509429abba (patch) | |
tree | c55d728226f215230e375240d0caddc7a654ac88 /libavcodec/h264_slice.c | |
parent | c2fa6bb0e8703a7a6aa10e11f9ab36094416d83f (diff) | |
download | ffmpeg-streaming-45286a625c6ced1f5c4c842244cbb4509429abba.zip ffmpeg-streaming-45286a625c6ced1f5c4c842244cbb4509429abba.tar.gz |
h264dec: make sure to only end a field if it has been started
Calling ff_h264_field_end() when the per-field state is not properly
initialized leads to all kinds of undefined behaviour.
CC: libav-stable@libav.org
Bug-Id: 977 978 992
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r-- | libavcodec/h264_slice.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 1b91088..db7628c 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1884,9 +1884,8 @@ int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal) sl = h->slice_ctx; } - if (h->current_slice && h->cur_pic_ptr && FIELD_PICTURE(h)) { + if (h->field_started) ff_h264_field_end(h, sl, 1); - } h->current_slice = 0; if (!h->first_field) { @@ -1902,6 +1901,7 @@ int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal) ret = h264_field_start(h, sl, nal); if (ret < 0) return ret; + h->field_started = 1; } } |