aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2009-08-03 17:47:44 -0700
committerJean-Baptiste Queru <jbq@google.com>2009-08-13 17:30:57 -0700
commit81115075d28e7df6b43fd2252b83211ba2a827de (patch)
tree121bd8db776c48f4b3eeaca202855998256aa698 /src
parent63fa90a7910d9f43f27a0bf9a6702f8fb44ce3e7 (diff)
downloadlatinime-81115075d28e7df6b43fd2252b83211ba2a827de.tar.gz
latinime-81115075d28e7df6b43fd2252b83211ba2a827de.tar.xz
latinime-81115075d28e7df6b43fd2252b83211ba2a827de.zip
Fix a stack overflow when typing long words. Limit the size of auto-added words.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/inputmethod/latin/LatinIME.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index 222e0c5a2..4113d9b2c 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -1169,6 +1169,9 @@ public class LatinIME extends InputMethodService
@Override
public void addWord(String word, int addFrequency) {
+ final int length = word.length();
+ // Don't add very short or very long words.
+ if (length < 2 || length > getMaxWordLength()) return;
super.addWord(word, addFrequency);
final int freq = getWordFrequency(word);
if (freq > PROMOTION_THRESHOLD) {