Search code examples
javaandroidbytecodedalvik

Android bytecode verification code


Where can I take a look at android bytecode verificator source, i.e. code which is responsible for throwing java.lang.VerifyError in case of incorrect bytecode? Does verification happens in java or C++ code?

Thanx.


Solution

  • You'll want to take a look at the art/runtime/verifier directory (e.g. method_verifier.cc), and also art/runtime/dex_file_verifier.cc. I think those are the main places where dex/bytecode verification happens, although there may be a few other things sprinkled around.

    I'm not sure offhand exactly where the VerifyError exception is thrown, but it is thrown based on the verification performed by the above-mentioned code.