mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app: [Android] avoid out-of-bounds access in getCursorCapsMode
Fixes: https://todo.sr.ht/~eliasnaur/gio/404 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-1
@@ -555,7 +555,11 @@ public final class GioView extends SurfaceView implements Choreographer.FrameCal
|
||||
@Override public int getCursorCapsMode(int reqModes) {
|
||||
Snippet snip = getSnippet();
|
||||
int selStart = imeSelectionStart(nhandle);
|
||||
return TextUtils.getCapsMode(snip.snippet, imeToUTF16(nhandle, selStart - snip.offset), reqModes);
|
||||
int off = imeToUTF16(nhandle, selStart - snip.offset);
|
||||
if (off < 0 || off > snip.snippet.length()) {
|
||||
return 0;
|
||||
}
|
||||
return TextUtils.getCapsMode(snip.snippet, off, reqModes);
|
||||
}
|
||||
|
||||
@Override public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
|
||||
|
||||
Reference in New Issue
Block a user