Bug 1606721 - Fix crash on screen reader text requests with bogus offsets, r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D82424
This commit is contained in:
Samuel Thibault 2020-07-08 22:46:28 +00:00
parent 08cdd6ddc7
commit 667bd111f3

View File

@ -122,6 +122,12 @@ gchar* NewATKString(AccessibleOrProxy* aAccessible, gint aStartOffset,
gint(aAccessible->CharacterCount()));
nsAutoString str;
aAccessible->TextSubstring(startOffset, endOffset, str);
if (str.Length() == 0) {
// Bogus offsets, or empty string, either way we do not need conversion.
return g_strdup("");
}
if (aFlags & AtkStringConvertFlags::ConvertTextToAsterisks)
ConvertTexttoAsterisks(str);
return converter.ConvertAdjusted(str);