alliedmodders / sourcepawn

A small, statically typed scripting language.
Other
363 stars 64 forks source link

Constant crash on the same instruction 'rep movs' #977

Open A1mDev opened 3 months ago

A1mDev commented 3 months ago

I can’t figure out what the problem is, different plugins crash on one instruction 'rep movs'. I'm using the latest version of sourcepawn.

image

sapphonie commented 2 months ago

Can you post a crash dump or a stack trace, please?

A1mDev commented 2 months ago

337863583-b4cc594d-1d0f-4136-9f7f-26ed7e9de5db I did not describe that this is a compiler problem, because if you rebuild the plugin using a new compiler, then after loading this plugin the server will crash

sapphonie commented 2 months ago

337863583-b4cc594d-1d0f-4136-9f7f-26ed7e9de5db I did not describe that this is a compiler problem, because if you rebuild the plugin using a new compiler, then after loading this plugin the server will crash

That's cool, could you post a text version of the complete stack trace instead of a grainy screenshot of part of it which nobody is going to bother transcribing by hand? Or, again, an actual crash dump, which would be more helpful.

Thanks Steph

A1mDev commented 2 months ago

I know that it’s not good to write such code, but I found such code in a plugin, and it is this that crashes the server, other plugins with the same instructions also crashed, but I don’t know which parts of the code were compiled incorrectly. Perhaps the code below will give some insight into why this issue might occur. Use source mod 1.12.7140 for testing (update sourcepawn submodule (#2146))

#include <sourcemod>

#define MAX_LEN 32

public void OnPluginStart()
{
    RegConsoleCmd("sm_getchar", Cmd_GetChar);
}

Action Cmd_GetChar(int iClient, int iArgs)
{
    PrintToServer("%s", FooterGet());
    return Plugin_Handled;
}

char[] FooterGet()
{
    static char buffer[MAX_LEN];
    Format(buffer, sizeof(buffer), "asdada");

    return buffer;
}