commit | dd435b305e1b69817c8f714572e6161f66111997 | [log] [tgz] |
---|---|---|
author | Yuichiro Hanada <yhanada@google.com> | Tue Sep 04 15:33:52 2012 +0900 |
committer | Yuichiro Hanada <yhanada@google.com> | Tue Sep 04 15:34:41 2012 +0900 |
tree | db533c09c7dd506aea3024eec08ca334279bbcff | |
parent | 2c0c1cc677b947521384c5b9bc2b7b0469929581 [diff] |
Check the length of the word when add to userhistory. Change-Id: I7f2fe1771eed6b610704892b24f8a0283a779162
diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java index 6c9d1c2..683ee4f 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
@@ -182,6 +182,10 @@ * The second word may not be null (a NullPointerException would be thrown). */ public int addToUserHistory(final String word1, String word2, boolean isValid) { + if (word2.length() >= BinaryDictionary.MAX_WORD_LENGTH || + (word1 != null && word1.length() >= BinaryDictionary.MAX_WORD_LENGTH)) { + return -1; + } if (mBigramListLock.tryLock()) { try { super.addWord(