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

Cannot handle apk file size > 2G #12

Open
crackleeeessyp opened this issue Oct 9, 2024 · 3 comments
Open

Cannot handle apk file size > 2G #12

crackleeeessyp opened this issue Oct 9, 2024 · 3 comments
Labels
good first issue Good for newcomers

Comments

@crackleeeessyp
Copy link

Seems the centralDirOffset is wrong if apk file size > 2G

image

@iyxan23
Copy link
Owner

iyxan23 commented Oct 9, 2024

thanks for reporting!

it looks like I missed that those fields are unsigned, and ByteBuffer is treating them as signed ints, which isn't right. I also did a quick search and found that ByteBuffer doesn't support reading unsigned ints directly. So, we'll need to create our own way to handle this, maybe by extending the ByteBuffer class.

but sorry, I can't dive into this right now as I'm pretty swamped. I'll take a look next month. If anyone else wants to give it a shot in the meantime, feel free! :)

@iyxan23 iyxan23 added the good first issue Good for newcomers label Oct 9, 2024
@crackleeeessyp
Copy link
Author

@iyxan23 , thanks for your quick response!

Are there any document I can refer for zip format, and if time available, I will try to fix it.

By the way, does APK support zip64? If it also supports zip64, I think we should also consider it

@iyxan23
Copy link
Owner

iyxan23 commented Oct 11, 2024

hi @crackleeeessyp

Are there any document I can refer for zip format, and if time available, I will try to fix it.

thanks for the helping hand, I really appreciate it! here are some of the sources I used:

// source: https://en.wikipedia.org/wiki/ZIP_(file_format)#Structure
// better source: https://users.cs.jmu.edu/buchhofp/forensics/formats/pkzip.html
// the real source: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

By the way, does APK support zip64? If it also supports zip64, I think we should also consider it

actually, that's the one thing that I have been wondering about whilst developing zipalign-java!

I haven't implemented it yet, and I don't think there are APKs out there that uses zip64, looking at this stackoverflow question. And also, I've seen several phones that flat-out throws an error "zip64 not supported" when users tries to install a zip64 apk (but interestingly, they exist?)

I'm honestly not sure whether or not zip64 should be implemented; if you wanted to do it, I'm all ears :)

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

No branches or pull requests

2 participants