diff options
author | 2014-05-28 11:32:01 +0000 | |
---|---|---|
committer | 2014-05-28 11:32:01 +0000 | |
commit | eeea786fb39efee7577c23337ff9c15c01ab1b64 (patch) | |
tree | 4eb16b4f02948a829fd5ddda2591d9dbba83e7df | |
parent | 664fceb03430bc5bad08919b1f7c8644bd1200bf (diff) | |
parent | 7852765a503fe6dab54e1c4ab9e5e6b7bbdc70f2 (diff) | |
download | latinime-eeea786fb39efee7577c23337ff9c15c01ab1b64.tar.gz latinime-eeea786fb39efee7577c23337ff9c15c01ab1b64.tar.xz latinime-eeea786fb39efee7577c23337ff9c15c01ab1b64.zip |
am 7852765a: Add length check for attaching a BoS marker.
* commit '7852765a503fe6dab54e1c4ab9e5e6b7bbdc70f2':
Add length check for attaching a BoS marker.
-rw-r--r-- | native/jni/src/suggest/core/session/prev_words_info.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/native/jni/src/suggest/core/session/prev_words_info.h b/native/jni/src/suggest/core/session/prev_words_info.h index a58000abb..56c53c1c2 100644 --- a/native/jni/src/suggest/core/session/prev_words_info.h +++ b/native/jni/src/suggest/core/session/prev_words_info.h @@ -92,7 +92,7 @@ class PrevWordsInfo { const DictionaryStructureWithBufferPolicy *const dictStructurePolicy, const int *const wordCodePoints, const int wordCodePointCount, const bool isBeginningOfSentence, const bool tryLowerCaseSearch) { - if (!dictStructurePolicy || !wordCodePoints) { + if (!dictStructurePolicy || !wordCodePoints || wordCodePointCount > MAX_WORD_LENGTH) { return NOT_A_DICT_POS; } int codePoints[MAX_WORD_LENGTH]; @@ -122,6 +122,9 @@ class PrevWordsInfo { const DictionaryStructureWithBufferPolicy *const dictStructurePolicy, const int *const wordCodePoints, const int wordCodePointCount, const bool isBeginningOfSentence) { + if (!dictStructurePolicy || !wordCodePoints || wordCodePointCount > MAX_WORD_LENGTH) { + return NOT_A_DICT_POS; + } int codePoints[MAX_WORD_LENGTH]; int codePointCount = wordCodePointCount; memmove(codePoints, wordCodePoints, sizeof(int) * codePointCount); |