summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2024-12-30 18:27:19 +0100
committerSteve Sakoman <steve@sakoman.com>2025-01-09 06:25:36 -0800
commit731ed65861c32149c314c33815ed605ebafd01f5 (patch)
tree1ac51ef6e3336aafe8cecd85bc6320b319894875
parent77aed6aa092959d6fa1e24fc8b16e71cf7d53945 (diff)
downloadpoky-731ed65861c32149c314c33815ed605ebafd01f5.tar.gz
gstreamer1.0-plugins-good: patch CVE-2024-47606
Pick commit related to gstreamer from: * https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8032 (From OE-Core rev: d68a84dd3419811ec7f487907d7412c6105979d0) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-allocator-Avoid-integer-overflow-when-allocating-sys.patch56
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0_1.22.12.bb1
2 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-allocator-Avoid-integer-overflow-when-allocating-sys.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-allocator-Avoid-integer-overflow-when-allocating-sys.patch
new file mode 100644
index 0000000000..5d8575711a
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-allocator-Avoid-integer-overflow-when-allocating-sys.patch
@@ -0,0 +1,56 @@
1From f1cdc6f24340f6cce4cc7020628002f5c70dd6c7 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
3Date: Thu, 26 Sep 2024 22:07:22 +0300
4Subject: [PATCH] allocator: Avoid integer overflow when allocating sysmem
5
6Thanks to Antonio Morales for finding and reporting the issue.
7
8Fixes GHSL-2024-166
9Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3851
10
11Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8032>
12
13CVE: CVE-2024-47606
14Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/f1cdc6f24340f6cce4cc7020628002f5c70dd6c7]
15Signed-off-by: Peter Marko <peter.marko@siemens.com>
16---
17 gst/gstallocator.c | 14 ++++++++++++++
18 1 file changed, 14 insertions(+)
19
20diff --git a/gst/gstallocator.c b/gst/gstallocator.c
21index 996f5dc946..198cfe9523 100644
22--- a/gst/gstallocator.c
23+++ b/gst/gstallocator.c
24@@ -430,8 +430,20 @@ _sysmem_new_block (GstMemoryFlags flags,
25 /* ensure configured alignment */
26 align |= gst_memory_alignment;
27 /* allocate more to compensate for alignment */
28+ if (align > G_MAXSIZE || maxsize > G_MAXSIZE - align) {
29+ GST_CAT_WARNING (GST_CAT_MEMORY,
30+ "Allocating %" G_GSIZE_FORMAT " bytes with alignment %" G_GSIZE_FORMAT
31+ "x overflows", maxsize, align);
32+ return NULL;
33+ }
34 maxsize += align;
35 /* alloc header and data in one block */
36+ if (maxsize > G_MAXSIZE - sizeof (GstMemorySystem)) {
37+ GST_CAT_WARNING (GST_CAT_MEMORY,
38+ "Allocating %" G_GSIZE_FORMAT " bytes with alignment %" G_GSIZE_FORMAT
39+ "x overflows", maxsize, align);
40+ return NULL;
41+ }
42 slice_size = sizeof (GstMemorySystem) + maxsize;
43
44 mem = g_slice_alloc (slice_size);
45@@ -481,6 +493,8 @@ _sysmem_copy (GstMemorySystem * mem, gssize offset, gsize size)
46 size = mem->mem.size > offset ? mem->mem.size - offset : 0;
47
48 copy = _sysmem_new_block (0, size, mem->mem.align, 0, size);
49+ if (!copy)
50+ return NULL;
51 GST_CAT_DEBUG (GST_CAT_PERFORMANCE,
52 "memcpy %" G_GSIZE_FORMAT " memory %p -> %p", size, mem, copy);
53 memcpy (copy->data, mem->data + mem->mem.offset + offset, size);
54--
552.30.2
56
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.22.12.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.22.12.bb
index 8486e258d5..e5a820e1ad 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.22.12.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.22.12.bb
@@ -21,6 +21,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.x
21 file://0002-tests-add-support-for-install-the-tests.patch \ 21 file://0002-tests-add-support-for-install-the-tests.patch \
22 file://0003-tests-use-a-dictionaries-for-environment.patch \ 22 file://0003-tests-use-a-dictionaries-for-environment.patch \
23 file://0004-tests-add-helper-script-to-run-the-installed_tests.patch \ 23 file://0004-tests-add-helper-script-to-run-the-installed_tests.patch \
24 file://0005-allocator-Avoid-integer-overflow-when-allocating-sys.patch \
24 " 25 "
25SRC_URI[sha256sum] = "ac352f3d02caa67f3b169daa9aa78b04dea0fc08a727de73cb28d89bd54c6f61" 26SRC_URI[sha256sum] = "ac352f3d02caa67f3b169daa9aa78b04dea0fc08a727de73cb28d89bd54c6f61"
26 27