File 0001-avutil-hwcontext-Don-t-assume-frames_uninit-is-reent.patch of Package ffmpeg-4
xxxxxxxxxx
1
From 3bb00c0a420c3ce83c6fafee30270d69622ccad7 Mon Sep 17 00:00:00 2001
2
From: Zhao Zhili <zhilizhao@tencent.com>
3
Date: Tue, 20 Feb 2024 20:08:55 +0800
4
Subject: [PATCH] avutil/hwcontext: Don't assume frames_uninit is reentrant
5
References: https://bugzilla.opensuse.org/1223070
6
References: CVE-2024-31578
7
8
Fix heap use after free when vulkan_frames_init failed.
9
10
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
11
---
12
libavutil/hwcontext.c | 8 ++------
13
1 file changed, 2 insertions(+), 6 deletions(-)
14
15
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
16
index 1d2c2d7920..aa1329bf2b 100644
17
--- a/libavutil/hwcontext.c
18
+++ b/libavutil/hwcontext.c
19
20
if (ctx->internal->hw_type->frames_init) {
21
ret = ctx->internal->hw_type->frames_init(ctx);
22
if (ret < 0)
23
- goto fail;
24
+ return ret;
25
}
26
27
if (ctx->internal->pool_internal && !ctx->pool)
28
29
if (ctx->initial_pool_size > 0) {
30
ret = hwframe_pool_prealloc(ref);
31
if (ret < 0)
32
- goto fail;
33
+ return ret;
34
}
35
36
return 0;
37
-fail:
38
- if (ctx->internal->hw_type->frames_uninit)
39
- ctx->internal->hw_type->frames_uninit(ctx);
40
- return ret;
41
}
42
43
int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref,
44
--
45
2.44.0
46
47