File ffmpeg-4-CVE-2024-35368.patch of Package ffmpeg-4
xxxxxxxxxx
1
From 4513300989502090c4fd6560544dce399a8cd53c Mon Sep 17 00:00:00 2001
2
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3
Date: Sun, 24 Sep 2023 13:15:48 +0200
4
Subject: [PATCH] avcodec/rkmppdec: Fix double-free on error
5
6
After having created the AVBuffer that is put into frame->buf[0],
7
ownership of several objects (namely an AVDRMFrameDescriptor,
8
an MppFrame and some AVBufferRefs framecontextref and decoder_ref)
9
has passed to the AVBuffer and therefore to the frame.
10
Yet it has nevertheless been freed manually on error
11
afterwards, which would lead to a double-free as soon
12
as the AVFrame is unreferenced.
13
14
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
15
---
16
libavcodec/rkmppdec.c | 4 ++--
17
1 file changed, 2 insertions(+), 2 deletions(-)
18
19
--- a/libavcodec/rkmppdec.c
20
+++ b/libavcodec/rkmppdec.c
21
22
23
frame->hw_frames_ctx = av_buffer_ref(decoder->frames_ref);
24
if (!frame->hw_frames_ctx) {
25
- ret = AVERROR(ENOMEM);
26
- goto fail;
27
+ av_frame_unref(frame);
28
+ return AVERROR(ENOMEM);
29
}
30
31
return 0;
32