glbasefilter: Need to check the display before lock it.
authorHe Junyan <junyan.he@intel.com>
Fri, 6 Nov 2020 07:36:01 +0000 (15:36 +0800)
committerHe Junyan <junyan.he@intel.com>
Thu, 3 Dec 2020 16:23:38 +0000 (00:23 +0800)
In find_gl_context_unlocked(), the display of filter may be NULL
and can cause crash if we directly access and lock it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/922>

gst-libs/gst/gl/gstglbasefilter.c

index 8671073..40f37e1 100644 (file)
@@ -541,6 +541,11 @@ gst_gl_base_filter_find_gl_context_unlocked (GstGLBaseFilter * filter)
 
   _find_local_gl_context_unlocked (filter);
 
+  if (!filter->display) {
+    GST_WARNING_OBJECT (filter, "filter has NULL display.");
+    return FALSE;
+  }
+
   if (!filter->context) {
     GST_OBJECT_LOCK (filter->display);
     do {