mirror of
https://github.com/revanced/Apktool.git
synced 2025-06-12 05:07:41 +02:00
Handle APKs with NULL padding on StringPools
- issue 664
This commit is contained in:
@ -41,10 +41,12 @@ public class StringBlock {
|
||||
* be at the chunk type.
|
||||
*/
|
||||
public static StringBlock read(ExtDataInput reader) throws IOException {
|
||||
reader.skipCheckInt(CHUNK_TYPE);
|
||||
reader.skipCheckChunkTypeInt(CHUNK_STRINGPOOL_TYPE, CHUNK_NULL_TYPE);
|
||||
int chunkSize = reader.readInt();
|
||||
|
||||
// ResStringPool_header
|
||||
int stringCount = reader.readInt();
|
||||
int styleOffsetCount = reader.readInt();
|
||||
int styleCount = reader.readInt();
|
||||
int flags = reader.readInt();
|
||||
int stringsOffset = reader.readInt();
|
||||
int stylesOffset = reader.readInt();
|
||||
@ -55,8 +57,8 @@ public class StringBlock {
|
||||
block.m_stringOwns = new int[stringCount];
|
||||
Arrays.fill(block.m_stringOwns, -1);
|
||||
|
||||
if (styleOffsetCount != 0) {
|
||||
block.m_styleOffsets = reader.readIntArray(styleOffsetCount);
|
||||
if (styleCount != 0) {
|
||||
block.m_styleOffsets = reader.readIntArray(styleCount);
|
||||
}
|
||||
{
|
||||
int size = ((stylesOffset == 0) ? chunkSize : stylesOffset)
|
||||
@ -343,6 +345,7 @@ public class StringBlock {
|
||||
private static final Logger LOGGER = Logger.getLogger(StringBlock.class.getName());
|
||||
|
||||
// ResChunk_header = header.type (0x0001) + header.headerSize (0x001C)
|
||||
private static final int CHUNK_TYPE = 0x001C0001;
|
||||
private static final int CHUNK_STRINGPOOL_TYPE = 0x001C0001;
|
||||
private static final int CHUNK_NULL_TYPE = 0x00000000;
|
||||
private static final int UTF8_FLAG = 0x00000100;
|
||||
}
|
||||
|
Reference in New Issue
Block a user