From 33fd6ae98638d2a4b33d18cc4acee4f0daaa9b35 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 6 Jun 2024 13:41:51 +0000 Subject: [PATCH] 8333622: ubsan: relocInfo_x86.cpp:101:56: runtime error: pointer index expression with base (-1) overflowed Reviewed-by: thartmann, chagedorn --- src/hotspot/cpu/x86/relocInfo_x86.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/relocInfo_x86.cpp b/src/hotspot/cpu/x86/relocInfo_x86.cpp index d7fddf838ac..2df98c4311b 100644 --- a/src/hotspot/cpu/x86/relocInfo_x86.cpp +++ b/src/hotspot/cpu/x86/relocInfo_x86.cpp @@ -98,7 +98,11 @@ address Relocation::pd_call_destination(address orig_addr) { if (ni->is_call()) { return nativeCall_at(addr())->destination() + adj; } else if (ni->is_jump()) { - return nativeJump_at(addr())->jump_destination() + adj; + address dest = nativeJump_at(addr())->jump_destination(); + if (dest == (address) -1) { + return addr(); // jump to self + } + return dest + adj; } else if (ni->is_cond_jump()) { return nativeGeneralJump_at(addr())->jump_destination() + adj; } else if (ni->is_mov_literal64()) {