From 1c727e8cbbd91391c5eb769c525a07ce5e058e20 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 12 Feb 2021 08:20:56 +0100 Subject: [PATCH 1/2] avcodec/mpeg12dec: don't call hw->end_frame when starting second field decoding This call is unbalanced with a hwaccel->start_frame. It fixes some crashes because this call ends up using uninitialized memory. Decoding works as expected after this patch. --- libavcodec/mpeg12dec.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 94221da2c1..335c3713c2 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1667,14 +1667,6 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) return AVERROR_INVALIDDATA; } - if (s->avctx->hwaccel) { - if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) { - av_log(avctx, AV_LOG_ERROR, - "hardware accelerator failed to decode first field\n"); - return ret; - } - } - for (i = 0; i < 4; i++) { s->current_picture.f->data[i] = s->current_picture_ptr->f->data[i]; if (s->picture_structure == PICT_BOTTOM_FIELD) -- 2.27.0.windows.1