summaryrefslogtreecommitdiffstats
path: root/vlc/build/patches/0001-avcodec-mpeg12dec-don-t-call-hw-end_frame-when-start.patch
blob: 8dd99a581a48e7e295229deb4337f79ba4f9ab1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 1c727e8cbbd91391c5eb769c525a07ce5e058e20 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
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