< prev index next >

src/share/vm/services/mallocTracker.hpp

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

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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.

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