Col-E / Recaf

The modern Java bytecode editor
https://recaf.coley.software
MIT License
6.07k stars 467 forks source link

Jar File Not Accessible in Recaf V3/V4 Due to Missing Central Directory Header #887

Open RareHyperIonYT opened 7 hours ago

RareHyperIonYT commented 7 hours ago

Describe the bug

I made my own program that takes a jar file by input to detect and remove a spigot backdoor but the output jar file cannot be accessed by V3 or V4 due to an "No Central-Directory-File-Reader found" error, it is accessible in V2 though.

I forgot to close the output stream which I assume caused the zip headers to not be written correctly but since it works in the JVM regardless of this I thought I might as well mention it. I had to upload it to media fire because github doesn't recognize it as a zip file.

To Reproduce

Steps to reproduce the behavior:

  1. Open sample in Recaf V3/V4

Exception

14:25:27.680 [BasicResourceImporter/path-loader-0] INFO : Reading input from ZIP container 'viaversionfixed.jar'
14:25:27.716 [WorkspaceExplorerPane/path-loader-0] ERROR: Failed to create new workspace from dropped files
java.io.IOException: No Central-Directory-File-Header found!
        at software.coley.lljzip.format.read.JvmZipReader.read(JvmZipReader.java:68)
        at software.coley.lljzip.ZipIO.read(ZipIO.java:257)
        at software.coley.lljzip.ZipIO.read(ZipIO.java:197)
        at software.coley.recaf.services.workspace.io.ResourceImporterConfig.lambda$mapping$0(ResourceImporterConfig.java:65)
        at software.coley.collections.func.UncheckedFunction.apply(UncheckedFunction.java:17)
        at software.coley.recaf.services.workspace.io.BasicResourceImporter.handleZip(BasicResourceImporter.java:142)
        at software.coley.recaf.services.workspace.io.BasicResourceImporter.handleSingle(BasicResourceImporter.java:107)
        at software.coley.recaf.services.workspace.io.BasicResourceImporter.importResource(BasicResourceImporter.java:592)
        at software.coley.recaf.services.workspace.io.BasicResourceImporter$Proxy$_$$_WeldClientProxy.importResource(Unknown Source)
        at software.coley.recaf.workspace.PathLoadingManager.lambda$asyncNewWorkspace$2(PathLoadingManager.java:84)
        at software.coley.recaf.util.threading.ThreadUtil.lambda$wrap$2(ThreadUtil.java:224)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1570)
Col-E commented 4 hours ago

Opens fine for me

image

Default IO/ZIP parse settings

image

RareHyperIonYT commented 2 hours ago

I accidentally uploaded the wrong one to mediafire my bad. This one should be the correct one. https://www.mediafire.com/file/6wx96oqrmmer25p/viaversion-fixed.jar/file