< prev index next >

src/share/vm/services/virtualMemoryTracker.hpp

Print this page
rev 12318 : 8167650: NMT should check for invalid MEMFLAGS
Reviewed-by: dholmes, mockner, cjplummer

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -91,10 +91,11 @@
   VirtualMemory  _virtual_memory[mt_number_of_types];
 
  public:
   inline VirtualMemory* by_type(MEMFLAGS flag) {
     int index = NMTUtil::flag_to_index(flag);
+    assert(index >= 0 && index < mt_number_of_types, "Index out of bound.");
     return &_virtual_memory[index];
   }
 
   inline VirtualMemory* by_index(int index) {
     assert(index >= 0, "Index out of bound");
< prev index next >