diff options
author | Thibault Saunier <tsaunier@gnome.org> | 2016-02-15 23:26:06 +0100 |
---|---|---|
committer | Thibault Saunier <tsaunier@gnome.org> | 2016-02-15 23:29:10 +0100 |
commit | 2a7c9fd82d01cbde54ed57cc8b409d32600e6101 (patch) | |
tree | 7c5997310b1671f491f2efb6e4ad00b9b862dc37 | |
parent | 4e0c7856c83266dff74204e770eccdbd8dd91702 (diff) |
gst: Fix a crash when passing wrong type as __templates__
-rw-r--r-- | gi/overrides/gstmodule.c | 9 | ||||
-rw-r--r-- | testsuite/common.py | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/gi/overrides/gstmodule.c b/gi/overrides/gstmodule.c index 6f9a14b..3739aed 100644 --- a/gi/overrides/gstmodule.c +++ b/gi/overrides/gstmodule.c @@ -147,7 +147,8 @@ add_templates (gpointer gclass, PyObject * templates) for (i = 0; i < len; i++) { templ = (PyGObject *) PyTuple_GetItem (templates, i); - if (GST_IS_PAD_TEMPLATE (pygobject_get (templ)) == FALSE) { + if (!pygobject_check (templates, &PyGObject_Type) || + GST_IS_PAD_TEMPLATE (pygobject_get (templates)) == FALSE) { PyErr_SetString (PyExc_TypeError, "entries for __gsttemplates__ must be of type GstPadTemplate"); return -1; @@ -161,11 +162,11 @@ add_templates (gpointer gclass, PyObject * templates) } return 0; - } - - if (GST_IS_PAD_TEMPLATE (pygobject_get (templates)) == FALSE) { + } else if (!pygobject_check (templates, &PyGObject_Type) || + GST_IS_PAD_TEMPLATE (pygobject_get (templates)) == FALSE) { PyErr_SetString (PyExc_TypeError, "entry for __gsttemplates__ must be of type GstPadTemplate"); + return -1; } diff --git a/testsuite/common.py b/testsuite/common.py index 9aab74c..d07eca2 100644 --- a/testsuite/common.py +++ b/testsuite/common.py @@ -31,7 +31,7 @@ import os import gc import unittest import gi.overrides -gi.overrides + from gi.repository import Gst |