[evince] ev-view-accessible: Fix a crash in ev_view_accessible_get_link



commit 7eac53fcdb8e32ede78d8a88f54cbf10daa920a3
Author: Antia Puentes <apuentes igalia com>
Date:   Tue Jul 30 19:33:12 2013 +0200

    ev-view-accessible: Fix a crash in ev_view_accessible_get_link
    
    Check array limits returning early if the link index is out of range.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705155

 libview/ev-view-accessible.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index c7965b6..f8009f5 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -998,6 +998,9 @@ ev_view_accessible_get_link (AtkHypertext *hypertext,
        EvMapping        *mapping;
        EvLinkAccessible *atk_link;
 
+       if (link_index < 0)
+               return NULL;
+
        widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (hypertext));
        if (widget == NULL)
                /* State is defunct */
@@ -1018,6 +1021,9 @@ ev_view_accessible_get_link (AtkHypertext *hypertext,
                return NULL;
 
        n_links = ev_mapping_list_length (link_mapping);
+       if (link_index > n_links - 1)
+               return NULL;
+
        mapping = ev_mapping_list_nth (link_mapping, n_links - link_index - 1);
        atk_link = ev_link_accessible_new (EV_VIEW_ACCESSIBLE (hypertext),
                                           EV_LINK (mapping->data),


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