[FFmpeg-cvslog] avcodec/h264_slice: Make setup_finished check cover more cases

Michael Niedermayer git at videolan.org
Wed Jul 27 20:35:00 EEST 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jul 27 18:22:41 2016 +0200| [8385e1718ee1fed107ec911d0b17fed3f7d74c71] | committer: Michael Niedermayer

avcodec/h264_slice: Make setup_finished check cover more cases

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8385e1718ee1fed107ec911d0b17fed3f7d74c71
---

 libavcodec/h264_slice.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 1fe89c3..e1de971 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1560,12 +1560,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl,
     if (ret < 0)
         return ret;
 
+    if (sl->first_mb_addr == 0 || !h->current_slice) {
+        if (h->setup_finished) {
+            av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n");
+            return AVERROR_INVALIDDATA;
+        }
+    }
+
     if (sl->first_mb_addr == 0) { // FIXME better field boundary detection
         if (h->current_slice) {
-            if (h->setup_finished) {
-                av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n");
-                return AVERROR_INVALIDDATA;
-            }
             if (h->max_contexts > 1) {
                 if (!h->single_decode_warning) {
                     av_log(h->avctx, AV_LOG_WARNING, "Cannot decode multiple access units as slice threads\n");



More information about the ffmpeg-cvslog mailing list