Verify jmethodID when calling methods.

The JNI Call<type>Method, CallNonvirtual<type>Method, and
CallStatic<type>Method functions take an object (or class) and a
jmethodID as arguments.  For virtual calls, if the jmethodID is not
for a method in the provided object, the VM can crash.  (The most
common way to accomplish this is to pass a class object into a virtual
method call.)

For static method calls, the method defines the class, and we ignore
the jclass argument.  Still, we don't want badly-formed code floating
around, so we just log a warning.

This is part of CheckJNI.

Bug 2577881.

Change-Id: Ia19f0cb604b06a6bd4da8e3d6238d4e162b1480e
1 file changed