6839888: Array overrun in vm adlc
authornever
Thu, 16 Dec 2010 12:47:52 -0800
changeset 7703 f02889c8dc88
parent 7702 b59d27191c78
child 7704 cc9d3ed42704
child 7705 50fdff25b18d
6839888: Array overrun in vm adlc Reviewed-by: kvn, iveresov
hotspot/src/share/vm/adlc/dict2.cpp
--- a/hotspot/src/share/vm/adlc/dict2.cpp	Thu Dec 16 01:46:02 2010 -0800
+++ b/hotspot/src/share/vm/adlc/dict2.cpp	Thu Dec 16 12:47:52 2010 -0800
@@ -34,7 +34,7 @@
 #define MAXID 20
 static char initflag = 0;       // True after 1st initialization
 static char shft[MAXID] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6};
-static short xsum[MAXID + 1];
+static short xsum[MAXID];
 
 //------------------------------bucket---------------------------------------
 class bucket {
@@ -66,7 +66,7 @@
   // Precompute table of null character hashes
   if( !initflag ) {             // Not initializated yet?
     xsum[0] = (1<<shft[0])+1;   // Initialize
-    for( i = 1; i < MAXID + 1; i++) {
+    for( i = 1; i < MAXID; i++) {
       xsum[i] = (1<<shft[i])+1+xsum[i-1];
     }
     initflag = 1;               // Never again
@@ -291,7 +291,7 @@
     c = (c<<1)+1;               // Characters are always odd!
     sum += c + (c<<shft[k++]);  // Universal hash function
   }
-  assert( k < (MAXID + 1), "Exceeded maximum name length");
+  assert( k < (MAXID), "Exceeded maximum name length");
   return (int)((sum+xsum[k]) >> 1); // Hash key, un-modulo'd table size
 }