From e9b20d5ee10aea3fcc600ce57685af7309fba921 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Mon, 26 Jul 2021 17:40:12 +0200 Subject: [PATCH] proc: use signed comparison when searching image for module data (#2621) StaticBase is the difference between the entry point declared in the image file and the entry point as loaded in memory, since this difference could be a negative number we have to use a signed comparison when searching for a mapping. Causes intermittent test failures on windows when resolving interface types for position independent executables. Fixes #2620 --- pkg/proc/bininfo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/proc/bininfo.go b/pkg/proc/bininfo.go index 991a18f5..f4f57383 100644 --- a/pkg/proc/bininfo.go +++ b/pkg/proc/bininfo.go @@ -722,10 +722,10 @@ func (bi *BinaryInfo) moduleDataToImage(md *moduleData) *Image { // Try searching for the image with the closest address preceding md.text var so *Image for i := range bi.Images { - if bi.Images[i].StaticBase > md.text { + if int64(bi.Images[i].StaticBase) > int64(md.text) { continue } - if so == nil || bi.Images[i].StaticBase > so.StaticBase { + if so == nil || int64(bi.Images[i].StaticBase) > int64(so.StaticBase) { so = bi.Images[i] } }