mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix: incompatible PtNode array size reading.
Bug: 11073222 Change-Id: I681be725b5c6dcc10aa536b00327698a7df75277
This commit is contained in:
parent
c1163c8518
commit
56e7e38d37
@ -436,7 +436,7 @@ public final class BinaryDictDecoderUtils {
|
|||||||
final FormatOptions options) {
|
final FormatOptions options) {
|
||||||
dictDecoder.setPosition(headerSize);
|
dictDecoder.setPosition(headerSize);
|
||||||
final int count = dictDecoder.readPtNodeCount();
|
final int count = dictDecoder.readPtNodeCount();
|
||||||
int groupPos = headerSize + BinaryDictIOUtils.getPtNodeCountSize(count);
|
int groupPos = dictDecoder.getPosition();
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
WeightedString result = null;
|
WeightedString result = null;
|
||||||
|
|
||||||
@ -498,9 +498,9 @@ public final class BinaryDictDecoderUtils {
|
|||||||
do { // Scan the linked-list node.
|
do { // Scan the linked-list node.
|
||||||
final int nodeArrayHeadPos = dictDecoder.getPosition();
|
final int nodeArrayHeadPos = dictDecoder.getPosition();
|
||||||
final int count = dictDecoder.readPtNodeCount();
|
final int count = dictDecoder.readPtNodeCount();
|
||||||
int groupOffsetPos = nodeArrayHeadPos + BinaryDictIOUtils.getPtNodeCountSize(count);
|
int groupPos = dictDecoder.getPosition();
|
||||||
for (int i = count; i > 0; --i) { // Scan the array of PtNode.
|
for (int i = count; i > 0; --i) { // Scan the array of PtNode.
|
||||||
PtNodeInfo info = dictDecoder.readPtNode(groupOffsetPos, options);
|
PtNodeInfo info = dictDecoder.readPtNode(groupPos, options);
|
||||||
if (BinaryDictIOUtils.isMovedPtNode(info.mFlags, options)) continue;
|
if (BinaryDictIOUtils.isMovedPtNode(info.mFlags, options)) continue;
|
||||||
ArrayList<WeightedString> shortcutTargets = info.mShortcutTargets;
|
ArrayList<WeightedString> shortcutTargets = info.mShortcutTargets;
|
||||||
ArrayList<WeightedString> bigrams = null;
|
ArrayList<WeightedString> bigrams = null;
|
||||||
@ -536,7 +536,7 @@ public final class BinaryDictDecoderUtils {
|
|||||||
0 != (info.mFlags & FormatSpec.FLAG_IS_NOT_A_WORD),
|
0 != (info.mFlags & FormatSpec.FLAG_IS_NOT_A_WORD),
|
||||||
0 != (info.mFlags & FormatSpec.FLAG_IS_BLACKLISTED)));
|
0 != (info.mFlags & FormatSpec.FLAG_IS_BLACKLISTED)));
|
||||||
}
|
}
|
||||||
groupOffsetPos = info.mEndAddress;
|
groupPos = info.mEndAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reach the end of the array.
|
// reach the end of the array.
|
||||||
|
@ -87,7 +87,7 @@ public final class BinaryDictIOUtils {
|
|||||||
|
|
||||||
if (p.mNumOfPtNode == Position.NOT_READ_PTNODE_COUNT) {
|
if (p.mNumOfPtNode == Position.NOT_READ_PTNODE_COUNT) {
|
||||||
p.mNumOfPtNode = dictDecoder.readPtNodeCount();
|
p.mNumOfPtNode = dictDecoder.readPtNodeCount();
|
||||||
p.mAddress += getPtNodeCountSize(p.mNumOfPtNode);
|
p.mAddress = dictDecoder.getPosition();
|
||||||
p.mPosition = 0;
|
p.mPosition = 0;
|
||||||
}
|
}
|
||||||
if (p.mNumOfPtNode == 0) {
|
if (p.mNumOfPtNode == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user