mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Commands: Revert e18f7aa, re-add .debug asan outofbounds, move bodies to #ifdef
This commit is contained in:
6
sql/updates/world/3.3.5/2020_08_17_02_world.sql
Normal file
6
sql/updates/world/3.3.5/2020_08_17_02_world.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
--
|
||||
DELETE FROM `command` WHERE `name`='debug asan outofbounds';
|
||||
INSERT INTO `command` (`name`,`permission`,`help`) VALUES
|
||||
('debug asan outofbounds',874,'Syntax: .debug asan outofbounds
|
||||
Triggers a stack out of bounds read.
|
||||
Use only when testing dynamic analysis tools.');
|
||||
@@ -81,6 +81,7 @@ public:
|
||||
static std::vector<ChatCommand> debugAsanCommandTable =
|
||||
{
|
||||
{ "memoryleak", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, &HandleDebugMemoryLeak, "" },
|
||||
{ "outofbounds", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, &HandleDebugOutOfBounds, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> debugCommandTable =
|
||||
{
|
||||
@@ -1704,10 +1705,23 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugOutOfBounds(ChatHandler* handler, CommandArgs* /*args*/)
|
||||
{
|
||||
#ifdef ASAN
|
||||
uint8 stack_array[10] = {};
|
||||
int size = 10;
|
||||
|
||||
handler->PSendSysMessage("Triggered an array out of bounds read at address %p, value %u", stack_array + size, stack_array[size]);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugMemoryLeak(ChatHandler* handler)
|
||||
{
|
||||
#ifdef ASAN
|
||||
uint8* leak = new uint8();
|
||||
handler->PSendSysMessage("Leaked 1 uint8 object at address %p", leak);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user