From 13fc00e539ae7d6a3cc828bb2dbdece300b5b184 Mon Sep 17 00:00:00 2001 From: jmjaffe37 Date: Thu, 12 Jun 2025 16:22:05 -0700 Subject: [PATCH] Now ensuring that enum index is positive: [SM02915] EnumIndex --- src/hotspot/share/services/memoryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/services/memoryManager.cpp b/src/hotspot/share/services/memoryManager.cpp index 36ea234c1f30b..a6eeefef10aa6 100644 --- a/src/hotspot/share/services/memoryManager.cpp +++ b/src/hotspot/share/services/memoryManager.cpp @@ -51,7 +51,7 @@ MemoryManager::MemoryManager(const char* name) int MemoryManager::add_pool(MemoryPool* pool) { int index = _num_pools; assert(index < MemoryManager::max_num_pools, "_num_pools exceeds the max"); - if (index < MemoryManager::max_num_pools) { + if (0 <= index && index < MemoryManager::max_num_pools) { _pools[index] = pool; _num_pools++; }