Skip to content

Commit

Permalink
Fix out-of-bounds exception in SetComposingRegion().
Browse files Browse the repository at this point in the history
BUG=401536

Review URL: https://codereview.chromium.org/445363009

Cr-Commit-Position: refs/heads/master@{#288198}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288198 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
bcwhite@chromium.org committed Aug 8, 2014
1 parent 3532235 commit ca971bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public boolean setComposingRegion(int start, int end) {

CharSequence regionText = null;
if (b > a) {
regionText = mEditable.subSequence(start, end);
regionText = mEditable.subSequence(a, b);
}
return mImeAdapter.setComposingRegion(regionText, a, b);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,21 @@ public void testKeyCodesWhileTypingText() throws Throwable {
assertEquals("", mConnection.getTextBeforeCursor(9, 0));
}

@SmallTest
@Feature({"TextInput", "Main"})
public void testSetComposingRegionOutOfBounds() throws Throwable {
DOMUtils.focusNode(mContentViewCore, "textarea");
assertWaitForKeyboardStatus(true);

mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
setComposingText(mConnection, "hello", 1);

setComposingRegion(mConnection, 0, 0);
setComposingRegion(mConnection, 0, 9);
setComposingRegion(mConnection, 9, 0);
}

@SmallTest
@Feature({"TextInput", "Main"})
public void testEnterKeyEventWhileComposingText() throws Throwable {
Expand Down

0 comments on commit ca971bd

Please sign in to comment.