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

Unable to open file, Wrong magic number #82

Closed
Infinitay opened this issue May 23, 2017 · 2 comments
Closed

Unable to open file, Wrong magic number #82

Infinitay opened this issue May 23, 2017 · 2 comments
Labels

Comments

@Infinitay
Copy link

java.lang.IllegalStateException: Wrong magic number: 52
at com.strobel.assembler.metadata.ClassFileReader.readClass(ClassFileReader.java:337)
at com.strobel.assembler.metadata.MetadataSystem.resolveType(MetadataSystem.java:124)
at com.strobel.assembler.metadata.MetadataSystem.lookupTypeCore(MetadataSystem.java:81)
at com.strobel.assembler.metadata.MetadataResolver.lookupType(MetadataResolver.java:46)
at us.deathmarine.luyten.Model.openEntryByTreePath(Model.java:338)
at us.deathmarine.luyten.Model$TreeListener$1.run(Model.java:266)

@greenozon
Copy link

The first thing a JVM does when it loads a class is check that the first four bytes are (in hex) CA FE BA BE. This is the "magic number" and thats why you are getting that error, you are trying to load a file that isnt a class and so the class loader in the JVM is throwing out that exception.

@deathmarine
Copy link
Owner

deathmarine commented May 23, 2017

#76, #64
@greenozon is right, however the files are not loaded to the virtual machine in procyon. I would say the jar is either corrupt, or the class could be encrypted, the software could be decrypting classes and loading them later as a sort of obfuscation. Either way I can only reproduce this intentionally, by renaming a binary file to class and putting it in a jar.
You may have to do a little more investigation, look for a class extending Classloader and pulling resources from the jar. I once wrote a wrapper that would decrypt and load each class and after phoning home and authenticating using a public and private key. Either way there is something else going on here.

@deathmarine deathmarine changed the title Unable to open file Unable to open file, Wrong magic number May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants