Fix LibraryLoader crash on error during context-transfer restoration
- Track whether transferred thread's original context was successfully restored. - In the catch block, leak the remote allocation instead of freeing it if the thread was not restored; this prevents the target process from executing freed memory. - Remove redundant 'op == 0x55' check in InstructionAnalyzer (already matched by (op & 0xF8) == 0x50). - Simplify MemoryBase ReadString align-down expression to previousLen - (previousLen % nullLen). - Change StubAllocator size parameter from nint to int for clarity (internal test seam). Tests: 199 passing, 4 integration/interactive skipped.
This commit is contained in:
@@ -41,7 +41,7 @@ public sealed class RemoteThreadExecutor
|
||||
/// When this delegate returns a non-zero pointer, the executor does not take
|
||||
/// ownership of that memory and will not free it.
|
||||
/// </remarks>
|
||||
internal Func<IntPtr, nint, IntPtr>? StubAllocator { get; set; }
|
||||
internal Func<IntPtr, int, IntPtr>? StubAllocator { get; set; }
|
||||
|
||||
/// <summary>Test seam: overrides remote scratch allocation for string/struct args.
|
||||
/// Defaults to <see cref="NativeMethods.VirtualAllocEx"/>.</summary>
|
||||
|
||||
Reference in New Issue
Block a user