diff src/share/vm/runtime/arguments.cpp @ 6982:e4f764ddb06a

7122219: Passed StringTableSize value not verified Summary: Check that the values specified for -XX:StringTableSize are within a certain range. Reviewed-by: dholmes, coleenp
author hseigel
date Mon, 12 Nov 2012 15:58:11 -0500
parents 8cb93eadfb6d
children 2cb439954abf 53715fb1597d
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Fri Nov 09 22:22:53 2012 -0800
+++ b/src/share/vm/runtime/arguments.cpp	Mon Nov 12 15:58:11 2012 -0500
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaAssertions.hpp"
+#include "classfile/symbolTable.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/cardTableRS.hpp"
@@ -1844,6 +1845,11 @@
   status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio");
   status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio");
 
+  // Divide by bucket size to prevent a large size from causing rollover when
+  // calculating amount of memory needed to be allocated for the String table.
+  status = status && verify_interval(StringTableSize, defaultStringTableSize,
+    (max_uintx / StringTable::bucket_size()), "StringTable size");
+
   if (MinHeapFreeRatio > MaxHeapFreeRatio) {
     jio_fprintf(defaultStream::error_stream(),
                 "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "