CRT Debug Assertion Failed - "Buffer too small" #170

Closed
ChristianIvicevic opened this Issue Feb 5, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@ChristianIvicevic

I have an injector which calls the following (shortened) code:

var processes = Process.GetProcessesByName("target");
/* ... */
var process = processes[0];
/* ... */
process.Kill();
RemoteHooking.CreateAndInject(process.MainModule.FileName, string.Empty, 0,
    InjectionOptions.NoService | InjectionOptions.DoNotRequireStrongName,
    typeof(EntryPoint).Assembly.Location, typeof(EntryPoint).Assembly.Location,
    out injectedProcessId, null);

The corresponding DLL just has the following:

public class EntryPoint : IEntryPoint {
    public EntryPoint(RemoteHooking.IContext InContext) {}

    public void Run(RemoteHooking.IContext InContext) {
        RemoteHooking.WakeUpProcess();
        Thread.Sleep(5000);
    }
}

Unfortunately when running with the NuGet libraries the injector just crashes with the typical Windows Error Reporting tool showing up and no visual exception message at all. The error from the Event View is this one:

Faulting application name: TestInjector.vshost.exe, version: 14.0.23107.0, time stamp: 0x559b788a
Faulting module name: EasyHook64.dll, version: 2.7.0.0, time stamp: 0x589704aa
Exception code: 0xc0000409
Fault offset: 0x0000000000091a9b

When running in debug mode, I am not able to step through the EasyHook code step by step, but I am getting at least one exception

Do you have any suggestions on how to further debug this issue and find out what's causing it?

@ChristianIvicevic

This comment has been minimized.

Show comment
Hide comment
@ChristianIvicevic

ChristianIvicevic Feb 6, 2017

I could resolve the error - the application that I was invoking was getting a command line argument as well (which is not in my sample code unfortunately) which is too long for the library. Therefore I increased the buffer size right here as well as the referring call to it right here and it works now without any issues.

I could resolve the error - the application that I was invoking was getting a command line argument as well (which is not in my sample code unfortunately) which is too long for the library. Therefore I increased the buffer size right here as well as the referring call to it right here and it works now without any issues.

@spazzarama

This comment has been minimized.

Show comment
Hide comment
@spazzarama

spazzarama Feb 13, 2017

Member

This has also been fixed on the Develop branch

Member

spazzarama commented Feb 13, 2017

This has also been fixed on the Develop branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment