JEB - Fix decompressor when string arrays aren't 4-byte aligned

This commit is contained in:
Connor Tumbleson 2014-11-01 21:21:35 -05:00
parent a7d8ca9086
commit 9b1c7d22ef

View File

@ -62,18 +62,20 @@ public class StringBlock {
}
{
int size = ((stylesOffset == 0) ? chunkSize : stylesOffset) - stringsOffset;
if ((size % 4) != 0) {
throw new IOException("String data size is not multiple of 4 (" + size + ").");
}
block.m_strings = new byte[size];
reader.readFully(block.m_strings);
}
if (stylesOffset != 0) {
int size = (chunkSize - stylesOffset);
if ((size % 4) != 0) {
throw new IOException("Style data size is not multiple of 4 (" + size + ").");
}
block.m_styles = reader.readIntArray(size / 4);
// read remaining bytes
int remaining = size % 4;
if (remaining >= 1) {
while (remaining-- > 0) {
reader.readByte();
}
}
}
return block;