mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Add length check for attaching a BoS marker.
Bug: 15297872 Change-Id: I7b0a27409b81b76561d19c6caa18a5011d3e90f6
This commit is contained in:
parent
6ee2cfa66c
commit
7852765a50
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user