[PATCH] Fix crash of decoder on MPEG2 interlaced streams (issue 2367)
anatoly
anatoly.nenashev
Fri Feb 18 10:08:05 CET 2011
---
libavcodec/mpeg12.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 3c73627..45c1881 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1640,6 +1640,8 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
AVCodecContext *avctx= s->avctx;
const int field_pic= s->picture_structure != PICT_FRAME;
const int lowres= s->avctx->lowres;
+ const int check_mb_inter = field_pic && !s->first_field &&
+ s->pict_type == FF_P_TYPE && !s->last_picture.data[0];
s->resync_mb_x=
s->resync_mb_y= -1;
@@ -1763,7 +1765,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 (!check_mb_inter || s->mb_intra ||
+ 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
--------------060202030709000505070600--
More information about the ffmpeg-devel
mailing list