could not parse bytecode: '}'
Mythra opened this issue · 6 comments
Hey,
First off thank you so much for this! I'm trying to analyze an example 1.8 kotlin codebase of mine, to get used to running the tool. When running the jarScan on a shadow jar I've compiled I'm running into a unique error:
$ ./jarScan.sh --mode=maxMethodSize --limit=325 --packages="dev.cynthia.*" ../../build/libs/project-0.1.0-SNAPSHOT-all.jar
14:26:02.641 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:02.670 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:02.804 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:02.844 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:02.869 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.081 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.094 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.187 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.198 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.204 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.226 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.243 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.261 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
14:26:03.405 [main] ERROR o.a.jitwatch.loader.BytecodeLoader - could not parse bytecode: '}'
[...]
The tool still prints out a CSV report, but I'm worried that it's not fully analyzing some classes due to this "could not parse bytecode", in fact I'm not sure which files are reporting them either. I'd be happy to give more logs, but I'm not quite sure what would be most helpful. So if you need anything from me just let me know.
Hi @securityinsanity
Any chance you can share the jar file you are trying to analyse?
Thanks,
Chris
Hey Chris,
Sure do you have an email or something I can send it to? I'd prefer to not share it publicly fully yet. If not, I can try to build a reproducible sample case that I don't mind sharing.
chris@chrisnewland.com please. Thanks
Email Sent. Thanks!
Thanks for the email. I think you've found a bug in JITWatch's bytecode parser.
Most of the failures are related to static inner class initialisers (clinit). I'll try and create a regression test and then fix.
Thanks for reporting!
Fixed by 4cf90e2
This was caused by a bug in the parser which didn't handle the case that a Code:
section could be followed directly by the closing }
without any line number table, exception table etc.
Thanks again for reporting @securityinsanity !