am 7242bf1a: Merge "Make readHeader check the header size before using it."

* commit '7242bf1a159b909db8a7c74e786e2391a4361d85':
  Make readHeader check the header size before using it.
main
Ken Wakasa 2013-08-13 01:40:19 -07:00 committed by Android Git Automerger
commit 855e6a22c8
1 changed files with 3 additions and 2 deletions

View File

@ -1683,13 +1683,14 @@ public final class BinaryDictInputOutput {
final HashMap<String, String> attributes = new HashMap<String, String>(); final HashMap<String, String> attributes = new HashMap<String, String>();
final int headerSize; final int headerSize;
headerSize = buffer.readInt(); headerSize = buffer.readInt();
populateOptions(buffer, headerSize, attributes);
buffer.position(headerSize);
if (headerSize < 0) { if (headerSize < 0) {
throw new UnsupportedFormatException("header size can't be negative."); throw new UnsupportedFormatException("header size can't be negative.");
} }
populateOptions(buffer, headerSize, attributes);
buffer.position(headerSize);
final FileHeader header = new FileHeader(headerSize, final FileHeader header = new FileHeader(headerSize,
new FusionDictionary.DictionaryOptions(attributes, new FusionDictionary.DictionaryOptions(attributes,
0 != (optionsFlags & FormatSpec.GERMAN_UMLAUT_PROCESSING_FLAG), 0 != (optionsFlags & FormatSpec.GERMAN_UMLAUT_PROCESSING_FLAG),