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:11:43 +0200
commit7c7c7ef28efd900ef0cb3e1ae302f202fce92ea9 (patch)
treed7a94f14c6890036c3c07a69f5c5801746931056 /libview
parentf3e061c86842a3d377e03765cd9d2b34152e746a (diff)
downloadatril-7c7c7ef28efd900ef0cb3e1ae302f202fce92ea9.tar.bz2
atril-7c7c7ef28efd900ef0cb3e1ae302f202fce92ea9.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);