avcodec/h264: Do not get stuck on IDR inter frames
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 31 Aug 2014 01:43:56 +0000 (03:43 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 31 Aug 2014 02:09:06 +0000 (04:09 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h264.c

index 8ed9f48..0fcc769 100644 (file)
@@ -1567,6 +1567,12 @@ again:
 
             switch (hx->nal_unit_type) {
             case NAL_IDR_SLICE:
+                if ((ptr[0] & 0xFC) == 0x98) {
+                    av_log(h->avctx, AV_LOG_ERROR, "Invalid inter IDR frame\n");
+                    h->next_outputed_poc = INT_MIN;
+                    ret = -1;
+                    goto end;
+                }
                 if (h->nal_unit_type != NAL_IDR_SLICE) {
                     av_log(h->avctx, AV_LOG_ERROR,
                            "Invalid mix of idr and non-idr slices\n");