< prev index next >

src/java.base/share/native/libverify/check_code.c

Print this page
rev 54010 : 8074817: Resolve disabled warnings for libverify
Reviewed-by: XXX

@@ -705,17 +705,19 @@
 
 done:
     return *pID;
 }
 
+#ifdef DEBUG
 static const char *
 ID_to_class_name(context_type *context, unsigned short ID)
 {
     hash_table_type *class_hash = &(context->class_hash);
     hash_bucket_type *bucket = GET_BUCKET(class_hash, ID);
     return bucket->name;
 }
+#endif
 
 static jclass
 ID_to_class(context_type *context, unsigned short ID)
 {
     hash_table_type *class_hash = &(context->class_hash);

@@ -1388,11 +1390,11 @@
     }
 
     case JVM_OPC_invokedynamic:
         CCerror(context,
                 "invokedynamic bytecode is not supported in this class file version");
-
+        break;
     case JVM_OPC_instanceof:
     case JVM_OPC_checkcast:
     case JVM_OPC_new:
     case JVM_OPC_anewarray:
     case JVM_OPC_multianewarray: {

@@ -1697,11 +1699,13 @@
             }
             index = _ck_ntohl(lpc[2]) - _ck_ntohl(lpc[1]);
             if ((index < 0) || (index > 65535)) {
                 return -1;      /* illegal */
             } else {
-                return (unsigned char *)(&lpc[index + 4]) - iptr;
+                unsigned char *finish = (unsigned char *)(&lpc[index + 4]);
+                assert(finish >= iptr);
+                return (int)(finish - iptr);
             }
         }
 
         case JVM_OPC_lookupswitch: {
             int *lpc = (int *) UCALIGN(iptr + 1);

@@ -1712,12 +1716,15 @@
             /* There can't be more than 64K labels because of the limit
              * on per-method byte code length.
              */
             if (npairs < 0 || npairs >= 65536)
                 return  -1;
-            else
-                return (unsigned char *)(&lpc[2 * (npairs + 1)]) - iptr;
+            else {
+                unsigned char *finish = (unsigned char *)(&lpc[2 * (npairs + 1)]);
+                assert(finish >= iptr);
+                return (int)(finish - iptr);
+            }
         }
 
         case JVM_OPC_wide:
             if (iptr + 1 >= end)
                 return -1; /* do not read pass the end */

@@ -3826,11 +3833,12 @@
                     /* Signature must have ';' after the class name.
                      * If it does not, return 0 and ITEM_Bogus in full_info. */
                     result = 0;
                     break;
                 }
-                length = finish - p;
+                assert(finish >= p);
+                length = (int)(finish - p);
                 if (length + 1 > (int)sizeof(buffer_space)) {
                     buffer = malloc(length + 1);
                     check_and_push(context, buffer, VM_MALLOC_BLK);
                 }
                 memcpy(buffer, p, length);
< prev index next >