Add MAX_BIGRAMS_IN_A_GROUP.
Change-Id: I128d5deb8e523045d7ad77d7a8fd3db944f71238
This commit is contained in:
parent
69c787f3b7
commit
7223cc2ef1
2 changed files with 6 additions and 1 deletions
|
@ -1297,7 +1297,8 @@ public final class BinaryDictInputOutput {
|
|||
ArrayList<PendingAttribute> bigrams = null;
|
||||
if (0 != (flags & FormatSpec.FLAG_HAS_BIGRAMS)) {
|
||||
bigrams = new ArrayList<PendingAttribute>();
|
||||
while (true) {
|
||||
int bigramCount = 0;
|
||||
while (bigramCount++ < FormatSpec.MAX_BIGRAMS_IN_A_GROUP) {
|
||||
final int bigramFlags = buffer.readUnsignedByte();
|
||||
++addressPointer;
|
||||
final int sign = 0 == (bigramFlags & FormatSpec.FLAG_ATTRIBUTE_OFFSET_NEGATIVE)
|
||||
|
@ -1325,6 +1326,9 @@ public final class BinaryDictInputOutput {
|
|||
bigramAddress));
|
||||
if (0 == (bigramFlags & FormatSpec.FLAG_ATTRIBUTE_HAS_NEXT)) break;
|
||||
}
|
||||
if (bigramCount >= FormatSpec.MAX_BIGRAMS_IN_A_GROUP) {
|
||||
MakedictLog.d("too many bigrams in a group.");
|
||||
}
|
||||
}
|
||||
return new CharGroupInfo(originalGroupAddress, addressPointer, flags, characters, frequency,
|
||||
parentAddress, childrenAddress, shortcutTargets, bigrams);
|
||||
|
|
|
@ -216,6 +216,7 @@ public final class FormatSpec {
|
|||
|
||||
static final int MAX_CHARGROUPS_FOR_ONE_BYTE_CHARGROUP_COUNT = 0x7F; // 127
|
||||
static final int MAX_CHARGROUPS_IN_A_NODE = 0x7FFF; // 32767
|
||||
static final int MAX_BIGRAMS_IN_A_GROUP = 10000;
|
||||
|
||||
static final int MAX_TERMINAL_FREQUENCY = 255;
|
||||
static final int MAX_BIGRAM_FREQUENCY = 15;
|
||||
|
|
Loading…
Reference in a new issue