diff options
author | Amith Yamasani <yamasani@google.com> | 2010-09-22 16:58:13 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2010-09-22 16:58:13 -0700 |
commit | 4198918eed8e44723417fad8a986cda664c92d5b (patch) | |
tree | af62a6801f1a1a81b0edaff1356e52370709732b | |
parent | 4374b23d6be406710b91be746229e6c548613410 (diff) | |
download | frameworks_base-4198918eed8e44723417fad8a986cda664c92d5b.zip frameworks_base-4198918eed8e44723417fad8a986cda664c92d5b.tar.gz frameworks_base-4198918eed8e44723417fad8a986cda664c92d5b.tar.bz2 |
Fix for IndexOutOfBounds in setComposingRegion.
Bug: 3000457
Check upper and lower bounds of the composing region and clip them.
Change-Id: I8128a2b581ce3d8a9ff6c71cc648c3e87163b3f5
-rw-r--r-- | core/java/android/view/inputmethod/BaseInputConnection.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java index 3801948..f7c869b 100644 --- a/core/java/android/view/inputmethod/BaseInputConnection.java +++ b/core/java/android/view/inputmethod/BaseInputConnection.java @@ -428,8 +428,12 @@ public class BaseInputConnection implements InputConnection { a = b; b = tmp; } + // Clip the end points to be within the content bounds. + final int length = content.length(); if (a < 0) a = 0; - if (b > content.length()) b = content.length(); + if (b < 0) b = 0; + if (a > length) a = length; + if (b > length) b = length; ensureDefaultComposingSpans(); if (mDefaultComposingSpans != null) { |