aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
diff options
context:
space:
mode:
authorYuichiro Hanada <yhanada@google.com>2013-08-13 17:06:25 +0900
committerYuichiro Hanada <yhanada@google.com>2013-08-13 17:06:25 +0900
commitb7bb9c97224f34253e9bcefa1f1a6b2fdb776bbe (patch)
tree121a70d5d3d7fa62fa0ce7fe5dcd4ebad57ff862 /java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
parente8264cab71af545a6124fc6137837b7459145d25 (diff)
downloadlatinime-b7bb9c97224f34253e9bcefa1f1a6b2fdb776bbe.tar.gz
latinime-b7bb9c97224f34253e9bcefa1f1a6b2fdb776bbe.tar.xz
latinime-b7bb9c97224f34253e9bcefa1f1a6b2fdb776bbe.zip
Make readHeader check the header size before using it.
Change-Id: I5dc3e2b674f7343ef57317fde6bdb7349a7fe04c
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
index e2fa0231d..e0874bbd5 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
@@ -1683,13 +1683,14 @@ public final class BinaryDictInputOutput {
final HashMap<String, String> attributes = new HashMap<String, String>();
final int headerSize;
headerSize = buffer.readInt();
- populateOptions(buffer, headerSize, attributes);
- buffer.position(headerSize);
if (headerSize < 0) {
throw new UnsupportedFormatException("header size can't be negative.");
}
+ populateOptions(buffer, headerSize, attributes);
+ buffer.position(headerSize);
+
final FileHeader header = new FileHeader(headerSize,
new FusionDictionary.DictionaryOptions(attributes,
0 != (optionsFlags & FormatSpec.GERMAN_UMLAUT_PROCESSING_FLAG),