From 4e54333ca1207059317fd0a0632062b18c14b28b Mon Sep 17 00:00:00 2001 From: sendaoYan Date: Sat, 21 Dec 2024 00:01:20 +0800 Subject: [PATCH] cast offset to intptr_t to avoid overflow --- src/hotspot/share/oops/compressedKlass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/oops/compressedKlass.cpp b/src/hotspot/share/oops/compressedKlass.cpp index db638941a0d88..ba77f412289bf 100644 --- a/src/hotspot/share/oops/compressedKlass.cpp +++ b/src/hotspot/share/oops/compressedKlass.cpp @@ -96,7 +96,7 @@ void CompressedKlassPointers::sanity_check_after_initialization() { // Check that Klass range is fully engulfed in the encoding range const address encoding_start = _base; - const address encoding_end = (address)((intptr_t)_base + nth_bit(narrow_klass_pointer_bits() + _shift)); + const address encoding_end = (address)((intptr_t)_base + (intptr_t)nth_bit(narrow_klass_pointer_bits() + _shift)); ASSERT_HERE_2(_klass_range_start >= _base && _klass_range_end <= encoding_end, "Resulting encoding range does not fully cover the class range");