Skip to content

Commit

Permalink
a11y: Fix crash with Orca screen reader
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jascrain authored and raveit65 committed Apr 5, 2018
1 parent f3e061c commit 7c7c7ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libview/ev-page-accessible.c
Expand Up @@ -489,9 +489,9 @@ ev_page_accessible_get_substring (AtkText *text,
return NULL; return NULL;


page_text = ev_page_cache_get_text (view->page_cache, self->priv->page); 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)) if (end_offset < 0 || end_offset > g_utf8_strlen (page_text, -1))
end_offset = strlen (page_text); end_offset = strlen (page_text);
start_offset = CLAMP (start_offset, 0, end_offset);


substring = g_utf8_substring (page_text, start_offset, end_offset); substring = g_utf8_substring (page_text, start_offset, end_offset);
normalized = g_utf8_normalize (substring, -1, G_NORMALIZE_NFKC); normalized = g_utf8_normalize (substring, -1, G_NORMALIZE_NFKC);
Expand Down

0 comments on commit 7c7c7ef

Please sign in to comment.