diff options
Diffstat (limited to 'meta')
2 files changed, 100 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0022-jpegdec-Directly-error-out-on-negotiation-failures.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0022-jpegdec-Directly-error-out-on-negotiation-failures.patch new file mode 100644 index 0000000000..037afdc4ee --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0022-jpegdec-Directly-error-out-on-negotiation-failures.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | From 3cdf206f4fc5a9860bfe1437ed3d01e7d23c6c3e 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 16:22:19 +0300 | ||
| 4 | Subject: [PATCH] jpegdec: Directly error out on negotiation failures | ||
| 5 | |||
| 6 | Thanks to Antonio Morales for finding and reporting the issue. | ||
| 7 | |||
| 8 | Fixes GHSL-2024-247 | ||
| 9 | Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3862 | ||
| 10 | |||
| 11 | Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8040> | ||
| 12 | |||
| 13 | CVE: CVE-2024-47599 | ||
| 14 | Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/3cdf206f4fc5a9860bfe1437ed3d01e7d23c6c3e] | ||
| 15 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 16 | --- | ||
| 17 | .../gst-plugins-good/ext/jpeg/gstjpegdec.c | 22 ++++++++++++++----- | ||
| 18 | 1 file changed, 17 insertions(+), 5 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c | ||
| 21 | index 51bc2d14bf..7523419835 100644 | ||
| 22 | --- a/ext/jpeg/gstjpegdec.c | ||
| 23 | +++ b/ext/jpeg/gstjpegdec.c | ||
| 24 | @@ -1068,13 +1068,14 @@ gst_jpeg_turbo_parse_ext_fmt_convert (GstJpegDec * dec, gint * clrspc) | ||
| 25 | } | ||
| 26 | #endif | ||
| 27 | |||
| 28 | -static void | ||
| 29 | +static gboolean | ||
| 30 | gst_jpeg_dec_negotiate (GstJpegDec * dec, gint width, gint height, gint clrspc, | ||
| 31 | gboolean interlaced) | ||
| 32 | { | ||
| 33 | GstVideoCodecState *outstate; | ||
| 34 | GstVideoInfo *info; | ||
| 35 | GstVideoFormat format; | ||
| 36 | + gboolean res; | ||
| 37 | |||
| 38 | #ifdef JCS_EXTENSIONS | ||
| 39 | if (dec->format_convert) { | ||
| 40 | @@ -1104,7 +1105,7 @@ gst_jpeg_dec_negotiate (GstJpegDec * dec, gint width, gint height, gint clrspc, | ||
| 41 | height == GST_VIDEO_INFO_HEIGHT (info) && | ||
| 42 | format == GST_VIDEO_INFO_FORMAT (info)) { | ||
| 43 | gst_video_codec_state_unref (outstate); | ||
| 44 | - return; | ||
| 45 | + return TRUE; | ||
| 46 | } | ||
| 47 | gst_video_codec_state_unref (outstate); | ||
| 48 | } | ||
| 49 | @@ -1118,6 +1119,8 @@ gst_jpeg_dec_negotiate (GstJpegDec * dec, gint width, gint height, gint clrspc, | ||
| 50 | outstate = | ||
| 51 | gst_video_decoder_set_output_state (GST_VIDEO_DECODER (dec), format, | ||
| 52 | width, height, dec->input_state); | ||
| 53 | + if (!outstate) | ||
| 54 | + return FALSE; | ||
| 55 | |||
| 56 | switch (clrspc) { | ||
| 57 | case JCS_RGB: | ||
| 58 | @@ -1142,10 +1145,12 @@ gst_jpeg_dec_negotiate (GstJpegDec * dec, gint width, gint height, gint clrspc, | ||
| 59 | |||
| 60 | gst_video_codec_state_unref (outstate); | ||
| 61 | |||
| 62 | - gst_video_decoder_negotiate (GST_VIDEO_DECODER (dec)); | ||
| 63 | + res = gst_video_decoder_negotiate (GST_VIDEO_DECODER (dec)); | ||
| 64 | |||
| 65 | GST_DEBUG_OBJECT (dec, "max_v_samp_factor=%d", dec->cinfo.max_v_samp_factor); | ||
| 66 | GST_DEBUG_OBJECT (dec, "max_h_samp_factor=%d", dec->cinfo.max_h_samp_factor); | ||
| 67 | + | ||
| 68 | + return res; | ||
| 69 | } | ||
| 70 | |||
| 71 | static GstFlowReturn | ||
| 72 | @@ -1425,8 +1430,9 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame) | ||
| 73 | num_fields = 1; | ||
| 74 | } | ||
| 75 | |||
| 76 | - gst_jpeg_dec_negotiate (dec, width, output_height, | ||
| 77 | - dec->cinfo.jpeg_color_space, num_fields == 2); | ||
| 78 | + if (!gst_jpeg_dec_negotiate (dec, width, output_height, | ||
| 79 | + dec->cinfo.jpeg_color_space, num_fields == 2)) | ||
| 80 | + goto negotiation_failed; | ||
| 81 | |||
| 82 | state = gst_video_decoder_get_output_state (bdec); | ||
| 83 | ret = gst_video_decoder_allocate_output_frame (bdec, frame); | ||
| 84 | @@ -1558,6 +1564,12 @@ map_failed: | ||
| 85 | ret = GST_FLOW_ERROR; | ||
| 86 | goto exit; | ||
| 87 | } | ||
| 88 | +negotiation_failed: | ||
| 89 | + { | ||
| 90 | + GST_ELEMENT_ERROR (dec, CORE, NEGOTIATION, (NULL), ("failed to negotiate")); | ||
| 91 | + ret = GST_FLOW_NOT_NEGOTIATED; | ||
| 92 | + goto exit; | ||
| 93 | + } | ||
| 94 | decode_error: | ||
| 95 | { | ||
| 96 | gchar err_msg[JMSG_LENGTH_MAX]; | ||
| 97 | -- | ||
| 98 | 2.30.2 | ||
| 99 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.12.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.12.bb index 96dd6f7228..85c9a20a2d 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.12.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.22.12.bb | |||
| @@ -28,6 +28,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-go | |||
| 28 | file://0019-matroskademux-Skip-over-laces-directly-when-postproc.patch \ | 28 | file://0019-matroskademux-Skip-over-laces-directly-when-postproc.patch \ |
| 29 | file://0020-matroskademux-Skip-over-zero-sized-Xiph-stream-heade.patch \ | 29 | file://0020-matroskademux-Skip-over-zero-sized-Xiph-stream-heade.patch \ |
| 30 | file://0021-matroskademux-Put-a-copy-of-the-codec-data-into-the-.patch \ | 30 | file://0021-matroskademux-Put-a-copy-of-the-codec-data-into-the-.patch \ |
| 31 | file://0022-jpegdec-Directly-error-out-on-negotiation-failures.patch \ | ||
| 31 | " | 32 | " |
| 32 | 33 | ||
| 33 | SRC_URI[sha256sum] = "9c1913f981900bd8867182639b20907b28ed78ef7a222cfbf2d8ba9dab992fa7" | 34 | SRC_URI[sha256sum] = "9c1913f981900bd8867182639b20907b28ed78ef7a222cfbf2d8ba9dab992fa7" |
