mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-24 21:51:49 +01:00
fix: prevent AsmHook from corrupting ReadJmpCallSig
This commit is contained in:
parent
214d9027b5
commit
647e2b3c0f
1 changed files with 9 additions and 5 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue