Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Mismatch in zip data descriptors #124

Closed
REAndroid opened this issue Aug 31, 2024 · 1 comment
Closed

[BUG] Mismatch in zip data descriptors #124

REAndroid opened this issue Aug 31, 2024 · 1 comment

Comments

@REAndroid
Copy link
Owner

          > Caused by: com.android.apksig.zip.ZipFormatException: Data Descriptor presence mismatch between Local File Header and Central Directory for entry AndroidManifest.xml. LFH: true, CD: false

The problem is with ZIP data descriptors, it's not a problem in the signature or AndroidManifest itself, but happens for all the files that are modified during merging I think (If you remove signature and preserve AndroidManifest.xml, same Data Descriptor presence mismatch exception thrown for resources.arsc).

I thought this is a mistake in apksig, because the APK will work fine if you remove the exception, but it's not (well it might still be unnecessary validation, but as Maximoff (developer of Apktool M) noted, apksig does not throw this exception for merged APKs normally, only in ReVanced Manager/CLI, so he thinks it may be caused by something when patching).

I don't know what exactly causes it or why, but I don't think this is a problem specific to APKEditor, because APKs merged by Apktool M and AntiSplit G2 have the same problem when patching with ReVanced. In AntiSplit M I simply removed the code from REAndroid which writes data descriptor, it works fine for merging, but I don't know if it would break other functions.

Originally posted by @AbdurazaaqMohammed in #116 (comment)

@REAndroid
Copy link
Owner Author

@AbdurazaaqMohammed
As you explained, data descriptor is placed correctly in accordance with flags. My assumption is the third party is making wrong validation, i guess the wrong validation is if entry == DEFLATED, then expect data-descriptors.

Anyways I found related issue on DataDescriptor values (crc, size, compressedSize) are always zero, it should be same as LocalFileHeader. I will try a fix on ARSCLib.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant