[PATCH] Fix decoding crash on some trashed interlaced MPEG2 streams. This fixes issue 2367.

anatoly anatoly.nenashev
Thu Feb 17 23:01:45 CET 2011


---
 libavcodec/mpeg12.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 3c73627..28292ab 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1763,7 +1763,12 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
         s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift;
         s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift;
 
+        if (s->mb_intra || !field_pic || s->last_picture.data[0] ||
+            s->first_field || s->picture_structure != s->field_select[0][0] + 1) {
         MPV_decode_mb(s, s->block);
+        } else {
+            av_log(avctx, AV_LOG_ERROR, "Some restrictions for inter prediction are broken, skipping macroblock\n");
+        }
 
         if (++s->mb_x >= s->mb_width) {
             const int mb_size= 16>>s->avctx->lowres;
-- 
1.7.1


--------------000707020908020606030909--



More information about the ffmpeg-devel mailing list