From 66747710a49ea6a78aee94d3a3ec6a24b7cc36e5 Mon Sep 17 00:00:00 2001 From: Dean Long Date: Fri, 23 May 2025 19:29:09 +0000 Subject: [PATCH] 8357468: [asan] heap buffer overflow reported in PcDesc::pc_offset() pcDesc.hpp:57 Reviewed-by: kvn, thartmann --- src/hotspot/share/code/nmethod.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index ed6167dac22..83afc02cdfc 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -393,7 +393,9 @@ static inline bool match_desc(PcDesc* pc, int pc_offset, bool approximate) { if (!approximate) { return pc->pc_offset() == pc_offset; } else { - return (pc-1)->pc_offset() < pc_offset && pc_offset <= pc->pc_offset(); + // Do not look before the sentinel + assert(pc_offset > PcDesc::lower_offset_limit, "illegal pc_offset"); + return pc_offset <= pc->pc_offset() && (pc-1)->pc_offset() < pc_offset; } }