From 398a6a2a1b0f781d261a91aa967c52b08d894098 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Tue, 6 Jun 2017 11:08:00 +0530 Subject: [PATCH] navigation: Add some validation while sending key/mouse events https://bugzilla.gnome.org/show_bug.cgi?id=783330 --- gst-libs/gst/video/navigation.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gst-libs/gst/video/navigation.c b/gst-libs/gst/video/navigation.c index d745ae02c8..9e6043e38d 100644 --- a/gst-libs/gst/video/navigation.c +++ b/gst-libs/gst/video/navigation.c @@ -122,6 +122,9 @@ void gst_navigation_send_key_event (GstNavigation * navigation, const char *event, const char *key) { + g_return_if_fail (g_strcmp0 (event, "key-press") == 0 || + g_strcmp0 (event, "key-release") == 0); + gst_navigation_send_event (navigation, gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING, event, "key", G_TYPE_STRING, key, NULL)); @@ -147,6 +150,10 @@ void gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event, int button, double x, double y) { + g_return_if_fail (g_strcmp0 (event, "mouse-button-press") == 0 || + g_strcmp0 (event, "mouse-button-release") == 0 || + g_strcmp0 (event, "mouse-move") == 0); + gst_navigation_send_event (navigation, gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING, event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,