diff options
3 files changed, 139 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0008-ssaparse-Search-for-closing-brace-after-opening-brac.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0008-ssaparse-Search-for-closing-brace-after-opening-brac.patch new file mode 100644 index 0000000000..a20d2b4cca --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0008-ssaparse-Search-for-closing-brace-after-opening-brac.patch | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | From 15bb318416e1bf6b6b557006a37d1da86c3a76a8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com> | ||
| 3 | Date: Mon, 30 Sep 2024 21:40:44 +0300 | ||
| 4 | Subject: [PATCH 1/2] ssaparse: Search for closing brace after opening brace | ||
| 5 | |||
| 6 | Otherwise removing anything between the braces leads to out of bound writes if | ||
| 7 | there is a closing brace before the first opening brace. | ||
| 8 | |||
| 9 | Thanks to Antonio Morales for finding and reporting the issue. | ||
| 10 | |||
| 11 | Fixes GHSL-2024-228 | ||
| 12 | Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3870 | ||
| 13 | |||
| 14 | Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8036> | ||
| 15 | |||
| 16 | CVE: CVE-2024-47541 | ||
| 17 | Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/15bb318416e1bf6b6b557006a37d1da86c3a76a8] | ||
| 18 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 19 | --- | ||
| 20 | gst/subparse/gstssaparse.c | 2 +- | ||
| 21 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 22 | |||
| 23 | diff --git a/gst/subparse/gstssaparse.c b/gst/subparse/gstssaparse.c | ||
| 24 | index 42fbb42b99..37b892e928 100644 | ||
| 25 | --- a/gst/subparse/gstssaparse.c | ||
| 26 | +++ b/gst/subparse/gstssaparse.c | ||
| 27 | @@ -238,7 +238,7 @@ gst_ssa_parse_remove_override_codes (GstSsaParse * parse, gchar * txt) | ||
| 28 | gboolean removed_any = FALSE; | ||
| 29 | |||
| 30 | while ((t = strchr (txt, '{'))) { | ||
| 31 | - end = strchr (txt, '}'); | ||
| 32 | + end = strchr (t, '}'); | ||
| 33 | if (end == NULL) { | ||
| 34 | GST_WARNING_OBJECT (parse, "Missing { for style override code"); | ||
| 35 | return removed_any; | ||
| 36 | -- | ||
| 37 | 2.30.2 | ||
| 38 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0009-ssaparse-Don-t-use-strstr-on-strings-that-are-potent.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0009-ssaparse-Don-t-use-strstr-on-strings-that-are-potent.patch new file mode 100644 index 0000000000..e6674c7bfd --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0009-ssaparse-Don-t-use-strstr-on-strings-that-are-potent.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | From 403b10eba06679319aa2e35d310236234782102f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com> | ||
| 3 | Date: Mon, 30 Sep 2024 18:36:19 +0300 | ||
| 4 | Subject: [PATCH 2/2] ssaparse: Don't use strstr() on strings that are | ||
| 5 | potentially not NULL-terminated | ||
| 6 | |||
| 7 | Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8036> | ||
| 8 | |||
| 9 | CVE: CVE-2024-47541 | ||
| 10 | Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/403b10eba06679319aa2e35d310236234782102f] | ||
| 11 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 12 | --- | ||
| 13 | gst/subparse/gstssaparse.c | 36 +++++++++++++++++++++++++++++++++++- | ||
| 14 | meson.build | 1 + | ||
| 15 | 2 files changed, 36 insertions(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/gst/subparse/gstssaparse.c b/gst/subparse/gstssaparse.c | ||
| 18 | index 37b892e928..c162a542f5 100644 | ||
| 19 | --- a/gst/subparse/gstssaparse.c | ||
| 20 | +++ b/gst/subparse/gstssaparse.c | ||
| 21 | @@ -146,6 +146,35 @@ gst_ssa_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) | ||
| 22 | return res; | ||
| 23 | } | ||
| 24 | |||
| 25 | +#ifndef HAVE_MEMMEM | ||
| 26 | +// memmem() is a GNU extension so if it's not available we'll need | ||
| 27 | +// our own implementation here. Thanks C. | ||
| 28 | +static void * | ||
| 29 | +my_memmem (const void *haystack, size_t haystacklen, const void *needle, | ||
| 30 | + size_t needlelen) | ||
| 31 | +{ | ||
| 32 | + const guint8 *cur, *end; | ||
| 33 | + | ||
| 34 | + if (needlelen > haystacklen) | ||
| 35 | + return NULL; | ||
| 36 | + if (needlelen == 0) | ||
| 37 | + return (void *) haystack; | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + cur = haystack; | ||
| 41 | + end = cur + haystacklen - needlelen; | ||
| 42 | + | ||
| 43 | + for (; cur <= end; cur++) { | ||
| 44 | + if (memcmp (cur, needle, needlelen) == 0) | ||
| 45 | + return (void *) cur; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + return NULL; | ||
| 49 | +} | ||
| 50 | +#else | ||
| 51 | +#define my_memmem memmem | ||
| 52 | +#endif | ||
| 53 | + | ||
| 54 | static gboolean | ||
| 55 | gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps) | ||
| 56 | { | ||
| 57 | @@ -154,6 +183,7 @@ gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps) | ||
| 58 | const GValue *val; | ||
| 59 | GstStructure *s; | ||
| 60 | const guchar bom_utf8[] = { 0xEF, 0xBB, 0xBF }; | ||
| 61 | + const guint8 header[] = "[Script Info]"; | ||
| 62 | const gchar *end; | ||
| 63 | GstBuffer *priv; | ||
| 64 | GstMapInfo map; | ||
| 65 | @@ -193,7 +223,7 @@ gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps) | ||
| 66 | left -= 3; | ||
| 67 | } | ||
| 68 | |||
| 69 | - if (!strstr (ptr, "[Script Info]")) | ||
| 70 | + if (!my_memmem (ptr, left, header, sizeof (header) - 1)) | ||
| 71 | goto invalid_init; | ||
| 72 | |||
| 73 | if (!g_utf8_validate (ptr, left, &end)) { | ||
| 74 | @@ -231,6 +261,10 @@ invalid_init: | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 78 | +#ifdef my_memmem | ||
| 79 | +#undef my_memmem | ||
| 80 | +#endif | ||
| 81 | + | ||
| 82 | static gboolean | ||
| 83 | gst_ssa_parse_remove_override_codes (GstSsaParse * parse, gchar * txt) | ||
| 84 | { | ||
| 85 | diff --git a/meson.build b/meson.build | ||
| 86 | index d1033bef4a..65d0944114 100644 | ||
| 87 | --- a/meson.build | ||
| 88 | +++ b/meson.build | ||
| 89 | @@ -199,6 +199,7 @@ check_functions = [ | ||
| 90 | ['HAVE_LRINTF', 'lrintf', '#include<math.h>'], | ||
| 91 | ['HAVE_MMAP', 'mmap', '#include<sys/mman.h>'], | ||
| 92 | ['HAVE_LOG2', 'log2', '#include<math.h>'], | ||
| 93 | + ['HAVE_MEMMEM', 'memmem', '#include<string.h>'], | ||
| 94 | ] | ||
| 95 | |||
| 96 | libm = cc.find_library('m', required : false) | ||
| 97 | -- | ||
| 98 | 2.30.2 | ||
| 99 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.22.12.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.22.12.bb index 18837e676d..e65de0036d 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.22.12.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.22.12.bb | |||
| @@ -14,6 +14,8 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-ba | |||
| 14 | file://0005-opusdec-Set-at-most-64-channels-to-NONE-position.patch \ | 14 | file://0005-opusdec-Set-at-most-64-channels-to-NONE-position.patch \ |
| 15 | file://0006-vorbis_parse-check-writes-to-GstOggStream.vorbis_mod.patch \ | 15 | file://0006-vorbis_parse-check-writes-to-GstOggStream.vorbis_mod.patch \ |
| 16 | file://0007-oggstream-review-and-fix-per-format-min_packet_size.patch \ | 16 | file://0007-oggstream-review-and-fix-per-format-min_packet_size.patch \ |
| 17 | file://0008-ssaparse-Search-for-closing-brace-after-opening-brac.patch \ | ||
| 18 | file://0009-ssaparse-Don-t-use-strstr-on-strings-that-are-potent.patch \ | ||
| 17 | " | 19 | " |
| 18 | SRC_URI[sha256sum] = "73cfadc3a6ffe77ed974cfd6fb391c605e4531f48db21dd6b9f42b8cb69bd8c1" | 20 | SRC_URI[sha256sum] = "73cfadc3a6ffe77ed974cfd6fb391c605e4531f48db21dd6b9f42b8cb69bd8c1" |
| 19 | 21 | ||
