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

Give proper user notification for corrupted Jars #373

Closed
Geolykt opened this issue Apr 18, 2021 · 3 comments
Closed

Give proper user notification for corrupted Jars #373

Geolykt opened this issue Apr 18, 2021 · 3 comments

Comments

@Geolykt
Copy link

Geolykt commented Apr 18, 2021

In my case I had a jar that had no zip END header, which of course leads to the jar not being usable. However the UI does not make this clear right away (other than the loading freezing very early) and the only thing making this fact apparent is the output of the console. Perhaps maybe give a warning in that case?
Example jar that causes this issue (renamed to .zip due to github's file extension limitation; I also own all rights to it) proof-of-concept.zip

@Col-E
Copy link
Owner

Col-E commented Apr 25, 2021

If anyone is aware of some ZIP libraries, or any different handling than what we do now (NIO?), for Java that handle this I can take a look at this. The default ZIP classes error out on the constructor, so its not really possible to cleanly work around this.

Crash since it reads the whole file before letting you visit each sub-item

java.util.zip.ZipException: error in opening zip file
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:225)
	at java.util.zip.ZipFile.<init>(ZipFile.java:155)
	at java.util.zip.ZipFile.<init>(ZipFile.java:169)

@Col-E
Copy link
Owner

Col-E commented Dec 5, 2021

For additional context, the zip file is usually comprised of 3 structs:

  • LocalFileHeader
    • Has the file contents and metadata
  • CentralDirectoryFileHeader
    • Has metadata, which trumps the LocalFileHeader's
  • EndOfCentralDirectory
    • Info about number of expected entries

This sample contains only LocalFileHeader entries.

@Col-E
Copy link
Owner

Col-E commented Sep 13, 2023

This has been vastly improved in 3x and even more in 4x which even lets you choose between 3 modes of ZIP parsing. Gonna call this done for now.

@Col-E Col-E closed this as completed Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants