From f6aa9e9a1d8e98b00a53f18359153d1e487efe57 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroynagi Date: Tue, 2 Jul 2013 18:39:56 +0900 Subject: [PATCH] Fix: Reading invalid dictionary position. Bug: 6669677 Change-Id: I3f4078aaa8cf72f3b366e7851457e9c753c0102f --- .../src/suggest/core/dictionary/terminal_attributes.h | 9 +++++---- 1 file 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); }