mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix: wrong size checking in SparseTable.
Bug: 13592288 Change-Id: I52f03081c5abf25e3c160e2b8fff5e98f8448499
This commit is contained in:
parent
7c20f140e0
commit
4c93770430
@ -41,13 +41,11 @@ uint32_t SparseTable::get(const int id) const {
|
||||
bool SparseTable::set(const int id, const uint32_t value) {
|
||||
const int posInIndexTable = getPosInIndexTable(id);
|
||||
// Extends the index table if needed.
|
||||
if (mIndexTableBuffer->getTailPosition() < posInIndexTable) {
|
||||
int tailPos = mIndexTableBuffer->getTailPosition();
|
||||
while(tailPos < posInIndexTable) {
|
||||
if (!mIndexTableBuffer->writeUintAndAdvancePosition(NOT_EXIST, INDEX_SIZE, &tailPos)) {
|
||||
AKLOGE("cannot extend index table. tailPos: %d to: %d", tailPos, posInIndexTable);
|
||||
return false;
|
||||
}
|
||||
int tailPos = mIndexTableBuffer->getTailPosition();
|
||||
while (tailPos <= posInIndexTable) {
|
||||
if (!mIndexTableBuffer->writeUintAndAdvancePosition(NOT_EXIST, INDEX_SIZE, &tailPos)) {
|
||||
AKLOGE("cannot extend index table. tailPos: %d to: %d", tailPos, posInIndexTable);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (contains(id)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user