h264: on reference overflow, reset the reference count to 0, not 1.
authorAnton Khirnov <anton@khirnov.net>
Thu, 14 Feb 2013 10:43:20 +0000 (11:43 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 2 Mar 2013 09:27:03 +0000 (10:27 +0100)
Since decode_slice_header() returns before the reference lists are
constructed, there are zero valid references.

CC:libav-stable@libav.org

libavcodec/h264.c

index d816835..7d24df2 100644 (file)
@@ -3391,7 +3391,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
 
     if (h->ref_count[0] > max_refs || h->ref_count[1] > max_refs) {
         av_log(h->avctx, AV_LOG_ERROR, "reference overflow\n");
-        h->ref_count[0] = h->ref_count[1] = 1;
+        h->ref_count[0] = h->ref_count[1] = 0;
         return AVERROR_INVALIDDATA;
     }