This commit is contained in:
Loskh 2026-02-17 23:34:21 +01:00 committed by GitHub
commit a022ffb10f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -287,16 +287,15 @@ public class SigScanner : IDisposable, ISigScanner
}
var scanRet = Scan(this.TextSectionBase, this.TextSectionSize, signature);
if (this.IsCopy)
scanRet = new IntPtr(scanRet.ToInt64() - this.moduleCopyOffset);
var insnByte = Marshal.ReadByte(scanRet);
var baseAddress = this.IsCopy ? this.moduleCopyOffset + this.Module.BaseAddress : this.Module.BaseAddress;
if (insnByte == 0xE8 || insnByte == 0xE9)
{
scanRet = ReadJmpCallSig(scanRet);
var rel = scanRet - this.Module.BaseAddress;
var rel = scanRet - baseAddress;
if (rel < 0 || rel >= this.TextSectionSize)
{
throw new KeyNotFoundException(
@ -304,6 +303,11 @@ public class SigScanner : IDisposable, ISigScanner
}
}
if (this.IsCopy)
{
scanRet = scanRet - this.moduleCopyOffset;
}
// If this is below the module, there's bound to be a problem with the sig/resolution... Let's not save it
// TODO: THIS IS A HACK! FIX THE ROOT CAUSE!
if (this.textCache != null && scanRet.ToInt64() >= this.Module.BaseAddress.ToInt64())