Skip to content

Commit e3ce0a4

Browse files
jascrainraveit65
authored andcommitted
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
1 parent 4065873 commit e3ce0a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libview/ev-page-accessible.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,9 @@ ev_page_accessible_get_substring (AtkText *text,
489489
return NULL;
490490

491491
page_text = ev_page_cache_get_text (view->page_cache, self->priv->page);
492-
start_offset = MAX (0, start_offset);
493492
if (end_offset < 0 || end_offset > g_utf8_strlen (page_text, -1))
494493
end_offset = strlen (page_text);
494+
start_offset = CLAMP (start_offset, 0, end_offset);
495495

496496
substring = g_utf8_substring (page_text, start_offset, end_offset);
497497
normalized = g_utf8_normalize (substring, -1, G_NORMALIZE_NFKC);

0 commit comments

Comments
 (0)