| 1 | From 7d7c9ce06837f20d5585f1bc28a47701d12cf8ec Mon Sep 17 00:00:00 2001
|
| 2 | From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <[email protected]>
|
| 3 | Date: Sun, 1 Mar 2026 10:53:21 +0200
|
| 4 | Subject: [PATCH] glcolorconvert: Fix NULL pointer dereference on buffers
|
| 5 | without video meta
|
| 6 |
|
| 7 | Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4935
|
| 8 | ---
|
| 9 | .../gst-libs/gst/gl/gstglcolorconvert.c | 14 ++++++++------
|
| 10 | 1 file changed, 8 insertions(+), 6 deletions(-)
|
| 11 |
|
| 12 | diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
|
| 13 | index f2dc2dc7bbb..c13b4df69de 100644
|
| 14 | |
| 15 | |
| 16 | @@ -3428,10 +3428,12 @@ _init_convert (GstGLColorConvert * convert)
|
| 17 | }
|
| 18 |
|
| 19 | GstVideoMeta *v_meta = gst_buffer_get_video_meta (convert->inbuf);
|
| 20 | - if (v_meta->width != convert->priv->padded_width
|
| 21 | - || v_meta->height != convert->priv->padded_height) {
|
| 22 | - gdouble padded_width = v_meta->width;
|
| 23 | - gdouble padded_height = v_meta->height;
|
| 24 | + if ((v_meta && (v_meta->width != convert->priv->padded_width
|
| 25 | + || v_meta->height != convert->priv->padded_height)) ||
|
| 26 | + (!v_meta && (convert->in_info.width != convert->priv->padded_width ||
|
| 27 | + convert->in_info.height != convert->priv->padded_height))) {
|
| 28 | + gdouble padded_width = v_meta ? v_meta->width : convert->in_info.width;
|
| 29 | + gdouble padded_height = v_meta ? v_meta->height : convert->in_info.height;
|
| 30 | gdouble display_width = GST_VIDEO_INFO_WIDTH (&convert->in_info);
|
| 31 | gdouble display_height = GST_VIDEO_INFO_HEIGHT (&convert->in_info);
|
| 32 |
|
| 33 | @@ -3449,8 +3451,8 @@ _init_convert (GstGLColorConvert * convert)
|
| 34 | crop_vertices, GL_STATIC_DRAW);
|
| 35 | gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
| 36 |
|
| 37 | - convert->priv->padded_width = v_meta->width;
|
| 38 | - convert->priv->padded_height = v_meta->height;
|
| 39 | + convert->priv->padded_width = padded_width;
|
| 40 | + convert->priv->padded_height = padded_height;
|
| 41 | }
|
| 42 |
|
| 43 | gl->BindTexture (GL_TEXTURE_2D, 0);
|
| 44 | --
|
| 45 | GitLab
|
| 46 |
|