mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-05-02 07:04:27 +02:00
fix: Read TypeHeader with min size REAndroid/APKEditor#15
This commit is contained in:
parent
fcee142be9
commit
3e87435a1d
@ -53,6 +53,9 @@ import java.util.List;
|
||||
public HeaderBlock(ChunkType chunkType){
|
||||
this(chunkType.ID);
|
||||
}
|
||||
public int getMinimumSize(){
|
||||
return countBytes();
|
||||
}
|
||||
public ByteArray getExtraBytes() {
|
||||
return extraBytes;
|
||||
}
|
||||
|
@ -30,6 +30,12 @@
|
||||
public InfoHeader() {
|
||||
this((short) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumSize(){
|
||||
return INFO_MIN_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
void initExtraBytes(ByteArray extraBytes, int difference){
|
||||
}
|
||||
@ -55,4 +61,6 @@
|
||||
infoHeader.readBytes(blockReader);
|
||||
return infoHeader;
|
||||
}
|
||||
|
||||
private static final int INFO_MIN_SIZE = 8;
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ public class TypeHeader extends HeaderBlock{
|
||||
addChild(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumSize(){
|
||||
return TYPE_MIN_SIZE;
|
||||
}
|
||||
public ByteItem getId() {
|
||||
return id;
|
||||
}
|
||||
@ -72,4 +76,7 @@ public class TypeHeader extends HeaderBlock{
|
||||
+", entriesStart=" + getEntriesStart()
|
||||
+", config=" + getConfig() + '}';
|
||||
}
|
||||
|
||||
//typeHeader.countBytes() - getConfig().countBytes() + ResConfig.SIZE_16
|
||||
private static final int TYPE_MIN_SIZE = 36;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ import java.io.*;
|
||||
}
|
||||
public TypeHeader readTypeHeader() throws IOException{
|
||||
TypeHeader typeHeader = new TypeHeader();
|
||||
if(available() < typeHeader.countBytes()){
|
||||
if(available() < typeHeader.getMinimumSize()){
|
||||
return null;
|
||||
}
|
||||
int pos = getPosition();
|
||||
@ -80,7 +80,7 @@ import java.io.*;
|
||||
}
|
||||
public InfoHeader readHeaderBlock() throws IOException {
|
||||
InfoHeader infoHeader = new InfoHeader();
|
||||
if(available() < infoHeader.countBytes()){
|
||||
if(available() < infoHeader.getMinimumSize()){
|
||||
return null;
|
||||
}
|
||||
int pos = getPosition();
|
||||
|
Loading…
x
Reference in New Issue
Block a user