changeset 6016:5455f4e43948 libavcodec

Make h264 decoder conform to requirements of mpegvideo's MPV_frame_start. Namely, that it should not be called if you are starting to decode a B frame without any reference pictures. Prevents an endless allocation cycle in MPV_frame_start that will end in picture buffer overflow and abort. Fixes roundup issue 216.
author heydowns
date Fri, 14 Dec 2007 05:37:23 +0000
parents bb4f24c580f5
children e1404acccac3
files h264.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Thu Dec 13 19:00:53 2007 +0000
+++ b/h264.c	Fri Dec 14 05:37:23 2007 +0000
@@ -3911,6 +3911,11 @@
     h->slice_type= slice_type;
 
     s->pict_type= h->slice_type; // to make a few old func happy, it's wrong though
+    if (s->pict_type == B_TYPE && s->last_picture_ptr == NULL) {
+        av_log(h->s.avctx, AV_LOG_ERROR,
+               "B picture before any references, skipping\n");
+        return -1;
+    }
 
     pps_id= get_ue_golomb(&s->gb);
     if(pps_id>=MAX_PPS_COUNT){