Check the number of slots in the Class.java definition against the number assumed by the VM, and abort if the Class has too many.

Change-Id: Ibcf4539ab98639c1c92e5d910c38ee1feb9c8c43
diff --git a/vm/oo/Class.c b/vm/oo/Class.c
index a34b983..119907e 100644
--- a/vm/oo/Class.c
+++ b/vm/oo/Class.c
@@ -2478,6 +2478,11 @@
             strcmp(clazz->descriptor, "Ljava/lang/Class;") == 0)
         {
             gDvm.classJavaLangClass = clazz;
+            if (clazz->ifieldCount > CLASS_FIELD_SLOTS) {
+                LOGE("java.lang.Class has %d slots (expected %d)",
+                     clazz->ifieldCount, CLASS_FIELD_SLOTS);
+                dvmAbort();
+            }
         } else {
             gDvm.classJavaLangClass =
                 dvmFindSystemClassNoInit("Ljava/lang/Class;");