summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Dalleau <frederic.dalleau@collabora.com>2017-05-02 10:32:54 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-05-02 14:26:21 +0300
commitca7fa6a661d8a394ef1ae6f28a09a0e35fb0ab3f (patch)
tree949a8dd6656ab32a4185f8384c4a56befa38cfe9
parentd108ed2251f1f402755d862e83ab0944c552f5c6 (diff)
basetransform: Check if meta transform_func is NULL before using it
An untested pointer segfaulted in webkit while playing video on imx6 sabrelite. It turned out that the imx plugin didn't implement the meta transform function. The following GST_DEBUG trace was visible: gstbasetransform.c:1779:foreach_metadata:<conv2> copy metadata GstImxVpuBufferMetaAPI Thread 26 vqueue:src received signal SIGSEGV, Segmentation fault. (gdb) bt 0x00000000 in ?? () 0x73f8d7d8 in foreach_metadata (inbuf=0xc9b020, meta=0x474b2490, user_data=<optimized out>) at gstbasetransform.c:1781 0x73eb3ea8 in gst_buffer_foreach_meta (buffer=buffer@entry=0xc9b020, func=0x73f8d705 <foreach_metadata>, user_data=user_data@entry=0x474b24d4) at gstbuffer.c:2234 https://bugzilla.gnome.org/show_bug.cgi?id=782050
-rw-r--r--libs/gst/base/gstbasetransform.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index 3157fb725..f90d75193 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -1712,10 +1712,15 @@ foreach_metadata (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data)
* function and when it returns %TRUE */
if (do_copy) {
GstMetaTransformCopy copy_data = { FALSE, 0, -1 };
- GST_DEBUG_OBJECT (trans, "copy metadata %s", g_type_name (info->api));
/* simply copy then */
- info->transform_func (outbuf, *meta, inbuf,
- _gst_meta_transform_copy, &copy_data);
+ if (info->transform_func) {
+ GST_DEBUG_OBJECT (trans, "copy metadata %s", g_type_name (info->api));
+ info->transform_func (outbuf, *meta, inbuf,
+ _gst_meta_transform_copy, &copy_data);
+ } else {
+ GST_DEBUG_OBJECT (trans, "couldn't copy metadata %s",
+ g_type_name (info->api));
+ }
}
return TRUE;
}