summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorJason Crain <[email protected]>2017-03-21 22:55:50 -0500
committerraveit65 <[email protected]>2018-04-05 17:51:07 +0200
commite3ce0a476ad56a6cbde385fd162ed841efae4d57 (patch)
tree138b417e426f9a1b3c26f47784d55da5cd2964e5 /libview
parent40658731425c4b767b7a4aa463ba2fffd5fa7114 (diff)
downloadatril-e3ce0a476ad56a6cbde385fd162ed841efae4d57.tar.bz2
atril-e3ce0a476ad56a6cbde385fd162ed841efae4d57.tar.xz
a11y: Fix crash with Orca screen reader
ev_page_accessible_get_substring gets called with out of bounds values leading to a crash. Clamp start_offset to a valid range. https://bugzilla.gnome.org/show_bug.cgi?id=777992 origin commit: https://git.gnome.org/browse/evince/commit/?id=b34f357
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-page-accessible.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libview/ev-page-accessible.c b/libview/ev-page-accessible.c
index 7e97b955..13ce8b0d 100644
--- a/libview/ev-page-accessible.c
+++ b/libview/ev-page-accessible.c
@@ -489,9 +489,9 @@ ev_page_accessible_get_substring (AtkText *text,
return NULL;
page_text = ev_page_cache_get_text (view->page_cache, self->priv->page);
- start_offset = MAX (0, start_offset);
if (end_offset < 0 || end_offset > g_utf8_strlen (page_text, -1))
end_offset = strlen (page_text);
+ start_offset = CLAMP (start_offset, 0, end_offset);
substring = g_utf8_substring (page_text, start_offset, end_offset);
normalized = g_utf8_normalize (substring, -1, G_NORMALIZE_NFKC);