[at-spi2-core: 23/32] _atspi_dbus_handle_event(): assert that the event source is not NULL before processing the event




commit d818a9f8d2fb23d149b54ee1c24568981f9789ad
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Dec 14 14:13:58 2021 -0600

    _atspi_dbus_handle_event(): assert that the event source is not NULL before processing the event
    
    Once we demarshal, the event.source should not be NULL.  It can come
    from the message path if it is *not* being a ScreenReader event, or
    from a variant argument.
    
    Fixes static-scan warnings of this sort:
    
    ../../../atspi/atspi-event-listener.c:248:9: warning: Access to field 'accessible_parent' results in a 
dereference of a null pointer (loaded from field 'source') [core.NullDereference]
        if (event->source->accessible_parent)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 atspi/atspi-event-listener.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c
index b5d7fe4e..5cdc8064 100644
--- a/atspi/atspi-event-listener.c
+++ b/atspi/atspi-event-listener.c
@@ -1094,6 +1094,8 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *data)
     break;
   }
 
+  g_assert (e.source != NULL);
+
   dbus_message_iter_next (&iter);
   if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY)
   {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]