vaapipostproc: lock ensure_filter with postproc_lock

gst_vaapipostproc_ensure_filter might free the allowed_srcpad_caps
and allowed_sinkpad_caps. This can race with copying these caps in
gst_vaapipostproc_transform_caps and lead to segfaults.

The gst_vaapipostproc_transform_caps function already locks
postproc_lock before copying the caps. Make sure that calls to
gst_vaapipostproc_ensure_filter also acquire this lock.

https://bugzilla.gnome.org/show_bug.cgi?id=791404
This commit is contained in:
Michael Tretter 2017-12-08 14:46:02 +01:00 committed by Víctor Manuel Jáquez Leal
parent 089b8982e9
commit aed4088967

View file

@ -306,7 +306,9 @@ gst_vaapipostproc_start (GstBaseTransform * trans)
ds_reset (&postproc->deinterlace_state);
if (!gst_vaapi_plugin_base_open (GST_VAAPI_PLUGIN_BASE (postproc)))
return FALSE;
g_mutex_lock (&postproc->postproc_lock);
gst_vaapipostproc_ensure_filter (postproc);
g_mutex_unlock (&postproc->postproc_lock);
return TRUE;
}
@ -1881,8 +1883,12 @@ cb_channels_init (GstVaapiPostproc * postproc)
if (postproc->cb_channels)
return;
if (!gst_vaapipostproc_ensure_filter (postproc))
g_mutex_lock (&postproc->postproc_lock);
if (!gst_vaapipostproc_ensure_filter (postproc)) {
g_mutex_unlock (&postproc->postproc_lock);
return;
}
g_mutex_unlock (&postproc->postproc_lock);
filter_ops = postproc->filter_ops ? g_ptr_array_ref (postproc->filter_ops)
: gst_vaapi_filter_get_operations (postproc->filter);