rednaga/axmlprinter

EOF Exception on a "proper" (usable) AXML File

strazzere opened this issue ยท 4 comments

[53%]tstrazzere@mil0:[~/repo/unpackme/contents] $ axmlprinter AndroidManifest.xml 
java.io.EOFException
	at android.content.res.IntReader.readInt(IntReader.java:104)
	at android.content.res.IntReader.readShort(IntReader.java:69)
	at android.content.res.chunk.sections.StringSection.readPool(StringSection.java:108)
	at android.content.res.chunk.sections.StringSection.readSection(StringSection.java:71)
	at android.content.res.chunk.sections.GenericChunkSection.<init>(GenericChunkSection.java:37)
	at android.content.res.chunk.sections.StringSection.<init>(StringSection.java:48)
	at android.content.res.chunk.ChunkUtil.createChunk(ChunkUtil.java:52)
	at android.content.res.AXMLResource.read(AXMLResource.java:92)
	at diff.rednaga.AXMLPrinter.main(AXMLPrinter.java:69)
<?xml version="1.0" encoding="utf-8"?>

Likely related to qihoo360 / jiagu protector

Sample : e15f2b96e52d78f317de97295e22f0c3ace38961

Same problem, this is the program log:

java.io.EOFException
        at android.content.res.IntReader.readInt(IntReader.java:104)
        at android.content.res.IntReader.readShort(IntReader.java:69)
        at android.content.res.chunk.sections.StringSection.readPool(StringSection.java:108)
        at android.content.res.chunk.sections.StringSection.readSection(StringSection.java:71)
        at android.content.res.chunk.sections.GenericChunkSection.<init>(GenericChunkSection.java:37)
        at android.content.res.chunk.sections.StringSection.<init>(StringSection.java:48)
        at android.content.res.chunk.ChunkUtil.createChunk(ChunkUtil.java:52)
        at android.content.res.AXMLResource.read(AXMLResource.java:90)
        at diff.rednaga.AXMLPrinter.main(AXMLPrinter.java:72)
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "android.content.res.chunk.PoolItem.getString()" is null
        at android.content.res.chunk.sections.StringSection.getStringIndex(StringSection.java:120)
        at android.content.res.chunk.types.Attribute.<init>(Attribute.java:48)
        at diff.rednaga.AXMLPrinter.main(AXMLPrinter.java:78)

Result:

<?xml version="1.0" encoding="utf-8"?>

AndroidManifest.zip

Should be fixed now;

java -jar build/libs/axmlprinter-0.1.7.jar AndroidManifest.xml | head
<?xml version="1.0" encoding="utf-8"?>
<manifest
	xmlns:android="http://schemas.android.com/apk/res/android"
	manifest:versionCode="9001030"
	manifest:versionName="9.1.30"
	manifest:installLocation="0"
	manifest:compileSdkVersion="34"
	manifest:compileSdkVersionCodename="14"
	platformBuildVersionName="14"
	platformBuildVersionCode="34"

This is mostly fixed, however there is still some oddness on some packers which could still be fixed. See the unit test for this issue and it's clear what needs to be fixed.

However, the axml will get printed out now, mostly correct.

This is actually fully fixed now, it won't be "mostly" correct but actually fully correct now.