From 1f88f411bce08dc1df820681aee8dba3cd132c24 Mon Sep 17 00:00:00 2001 From: Bo Elmgreen Date: Wed, 30 Nov 2022 14:32:52 +0100 Subject: [PATCH] qt: deactivate context if fill_info fails Now the OpenGL context is deactivated if call to gst_gl_context_fill_info() fails in gst_qt_get_gl_wrapcontext(), preventing that the context is left activated, which could lead to invalid memory reads. Part-of: --- subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc | 1 + subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc b/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc index ad04f14..84d5618 100644 --- a/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc +++ b/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc @@ -248,6 +248,7 @@ gst_qt_get_gl_wrapcontext (GstGLDisplay * display, gst_gl_context_activate(*wrap_glcontext, TRUE); if (!gst_gl_context_fill_info (*wrap_glcontext, &error)) { GST_ERROR ("failed to retrieve qt context info: %s", error->message); + gst_gl_context_activate(*wrap_glcontext, FALSE); gst_clear_object (wrap_glcontext); return FALSE; } diff --git a/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc b/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc index ae21904..11daec3 100644 --- a/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc +++ b/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc @@ -246,6 +246,7 @@ gst_qml6_get_gl_wrapcontext (GstGLDisplay * display, gst_gl_context_activate(*wrap_glcontext, TRUE); if (!gst_gl_context_fill_info (*wrap_glcontext, &error)) { GST_ERROR ("failed to retrieve qt context info: %s", error->message); + gst_gl_context_activate(*wrap_glcontext, FALSE); gst_clear_object (wrap_glcontext); return FALSE; } -- 2.7.4