aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeisuke Kuroynagi <ksk@google.com>2013-07-02 09:42:52 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-02 09:42:53 +0000
commit07718a5e7d31fee7aa9bcddda38ce04fabf6c5ac (patch)
tree9f3d413491c5feeb409a28b2e9d1f1cd3d7cf91e
parent21648562050af77147c5ffd1b111de8906c66697 (diff)
parentf6aa9e9a1d8e98b00a53f18359153d1e487efe57 (diff)
downloadlatinime-07718a5e7d31fee7aa9bcddda38ce04fabf6c5ac.tar.gz
latinime-07718a5e7d31fee7aa9bcddda38ce04fabf6c5ac.tar.xz
latinime-07718a5e7d31fee7aa9bcddda38ce04fabf6c5ac.zip
Merge "Fix: Reading invalid dictionary position."
-rw-r--r--native/jni/src/suggest/core/dictionary/terminal_attributes.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/native/jni/src/suggest/core/dictionary/terminal_attributes.h b/native/jni/src/suggest/core/dictionary/terminal_attributes.h
index cec47081e..a8520b1f1 100644
--- a/native/jni/src/suggest/core/dictionary/terminal_attributes.h
+++ b/native/jni/src/suggest/core/dictionary/terminal_attributes.h
@@ -76,12 +76,13 @@ class TerminalAttributes {
mNodeFlags(nodeFlags), mShortcutListSizePos(shortcutPos) {}
inline ShortcutIterator getShortcutIterator() const {
- // The size of the shortcuts is stored here so that the whole shortcut chunk can be
- // skipped quickly, so we ignore it.
int shortcutPos = mShortcutListSizePos;
- BinaryDictionaryTerminalAttributesReadingUtils::getShortcutListSizeAndForwardPointer(
- mBinaryDictionaryInfo, &shortcutPos);
const bool hasShortcutList = 0 != (mNodeFlags & BinaryFormat::FLAG_HAS_SHORTCUT_TARGETS);
+ if (hasShortcutList) {
+ BinaryDictionaryTerminalAttributesReadingUtils::getShortcutListSizeAndForwardPointer(
+ mBinaryDictionaryInfo, &shortcutPos);
+ }
+ // shortcutPos is never used if hasShortcutList is false.
return ShortcutIterator(mBinaryDictionaryInfo, shortcutPos, hasShortcutList);
}