REAndroid / APKEditor

Powerful android apk editor - aapt/aapt2 independent
Apache License 2.0
647 stars 95 forks source link

Can't protect large APK #44

Closed Yehh22 closed 11 months ago

Yehh22 commented 12 months ago

Describe the bug APKEditor fail to protect large APK file. I'm using Java 19.0.2 on Windows 11

To Reproduce Steps to reproduce the behavior:

  1. java -jar APKEditor.jar p -i (apk)

Log/Stacktrace

00.027 I: [PROTECT] Loading apk ...

Unexpected error:
arraycopy: source index -1826102770 out of bounds for byte[102400]
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -1826102770 out of bounds for byte[102400]
        at java.base/java.lang.System.arraycopy(Native Method)
        at com.reandroid.common.FileChannelInputStream.readBuffer(FileChannelInputStream.java:99)
        at com.reandroid.common.FileChannelInputStream.read(FileChannelInputStream.java:77)
        at com.reandroid.archive2.block.ZipHeader.readBasic(ZipHeader.java:45)
        at com.reandroid.archive2.block.ZipHeader.readBytes(ZipHeader.java:33)
        at com.reandroid.archive2.block.LocalFileHeader.read(LocalFileHeader.java:92)
        at com.reandroid.archive2.model.LocalFileDirectory.visitLocalFile(LocalFileDirectory.java:55)
        at com.reandroid.archive2.model.LocalFileDirectory.visit(LocalFileDirectory.java:41)
        at com.reandroid.archive2.Archive.<init>(Archive.java:45)
        at com.reandroid.archive2.Archive.<init>(Archive.java:63)
        at com.reandroid.apk.ApkModule.loadApkFile(ApkModule.java:1126)
        at com.reandroid.apkeditor.protect.Protector.run(Protector.java:48)
        at com.reandroid.apkeditor.protect.Protector.execute(Protector.java:158)
        at com.reandroid.apkeditor.Main.execute(Main.java:80)
        at com.reandroid.apkeditor.Main.main(Main.java:41)

Used apk file https://mega.nz/file/HMYGDJqR#6gb1g-scoQI_j3m7Tg9GzfMsOI9kHHlVj2M4HVSxqXs

REAndroid commented 12 months ago

I didn't test with such file before, thanks for reporting and it will be fixed on next version

REAndroid commented 11 months ago

Fixed on 488591d Check the latest release