diff options
-rw-r--r-- | sql/base/auth_database.sql | 6 | ||||
-rw-r--r-- | sql/updates/auth/3.3.5/2019_04_27_00_auth.sql | 3 | ||||
-rw-r--r-- | sql/updates/world/3.3.5/2019_04_27_00_world.sql | 18 | ||||
-rw-r--r-- | src/server/game/Accounts/RBAC.h | 1 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 22 |
5 files changed, 48 insertions, 2 deletions
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql index 747020155cb..53fbc922fd7 100644 --- a/sql/base/auth_database.sql +++ b/sql/base/auth_database.sql @@ -1646,7 +1646,8 @@ INSERT INTO `rbac_permissions` VALUES (870,'Command: debug threatinfo'), (871,'Command: debug instancespawn'), (872,'Command: server debug'), -(873,'Command: reload creature_movement_override'); +(873,'Command: reload creature_movement_override'), +(874,'Command: debug asan'); /*!40000 ALTER TABLE `rbac_permissions` ENABLE KEYS */; UNLOCK TABLES; @@ -1777,7 +1778,8 @@ INSERT INTO `updates` VALUES ('2018_09_17_00_auth.sql','4DB671F0A4FA1A93AF28FB6426AF13DE72C7DA3D','ARCHIVED','2018-09-17 00:00:00',0), ('2018_12_30_00_auth.sql','680F4F9194FC37592041C2DB5B2B7006B14E836D','ARCHIVED','2018-12-30 00:00:00',0), ('2019_03_19_00_auth.sql','03BA8CFC60ACD5B874840A3E50F11CD2643730A0','ARCHIVED','2019-03-19 07:17:45',5), -('2019_04_15_00_auth.sql','EC67389946A24BFAA226B9DFCFEDB3BA095B4C42','ARCHIVED','2019-04-15 06:16:09',5); +('2019_04_15_00_auth.sql','EC67389946A24BFAA226B9DFCFEDB3BA095B4C42','ARCHIVED','2019-04-15 06:16:09',5), +('2019_04_27_00_auth.sql','84B1EB9CC9B09BAF55E6295D202EC57D99B1B60E','ARCHIVED','2019-04-27 18:07:18',0); /*!40000 ALTER TABLE `updates` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/updates/auth/3.3.5/2019_04_27_00_auth.sql b/sql/updates/auth/3.3.5/2019_04_27_00_auth.sql new file mode 100644 index 00000000000..d8f01cc9db3 --- /dev/null +++ b/sql/updates/auth/3.3.5/2019_04_27_00_auth.sql @@ -0,0 +1,3 @@ +-- +DELETE FROM `rbac_permissions` WHERE `id`= 874; +INSERT INTO `rbac_permissions` (`id`,`name`) VALUES (874, 'Command: debug asan'); diff --git a/sql/updates/world/3.3.5/2019_04_27_00_world.sql b/sql/updates/world/3.3.5/2019_04_27_00_world.sql new file mode 100644 index 00000000000..87f7cacf4dd --- /dev/null +++ b/sql/updates/world/3.3.5/2019_04_27_00_world.sql @@ -0,0 +1,18 @@ +-- +DELETE FROM `command` WHERE `name`='debug asan'; +INSERT INTO `command` (`name`,`permission`,`help`) VALUES +('debug asan',874,'Syntax: .debug asan $subcommand +Type .debug asan to see the list of possible subcommands or .help debug asan $subcommand to see info on subcommands. +Use only when testing dynamic analysis tools.'); + +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.'); + +DELETE FROM `command` WHERE `name`='debug asan memoryleak'; +INSERT INTO `command` (`name`,`permission`,`help`) VALUES +('debug asan memoryleak',874,'Syntax: .debug asan memoryleak +Triggers a memory leak. +Use only when testing dynamic analysis tools.'); diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h index 935d5b179ac..72951e0f77c 100644 --- a/src/server/game/Accounts/RBAC.h +++ b/src/server/game/Accounts/RBAC.h @@ -771,6 +771,7 @@ enum RBACPermissions RBAC_PERM_COMMAND_DEBUG_INSTANCESPAWN = 871, RBAC_PERM_COMMAND_SERVER_DEBUG = 872, RBAC_PERM_COMMAND_RELOAD_CREATURE_MOVEMENT_OVERRIDE = 873, + RBAC_PERM_COMMAND_DEBUG_ASAN = 874, // // IF YOU ADD NEW PERMISSIONS, ADD THEM IN MASTER BRANCH AS WELL! // diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 66838978fc1..9e54c1986e7 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -73,6 +73,11 @@ public: { "setphaseshift", rbac::RBAC_PERM_COMMAND_DEBUG_SEND_SETPHASESHIFT, false, &HandleDebugSendSetPhaseShiftCommand, "" }, { "spellfail", rbac::RBAC_PERM_COMMAND_DEBUG_SEND_SPELLFAIL, false, &HandleDebugSendSpellFailCommand, "" }, }; + 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 = { { "setbit", rbac::RBAC_PERM_COMMAND_DEBUG_SETBIT, false, &HandleDebugSet32BitCommand, "" }, @@ -108,6 +113,7 @@ public: { "neargraveyard", rbac::RBAC_PERM_COMMAND_NEARGRAVEYARD, false, &HandleDebugNearGraveyard, "" }, { "instancespawn", rbac::RBAC_PERM_COMMAND_DEBUG_INSTANCESPAWN, false, &HandleDebugInstanceSpawns, "" }, { "dummy", rbac::RBAC_PERM_COMMAND_DEBUG_DUMMY, false, &HandleDebugDummyCommand, "" }, + { "asan", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, nullptr, "", debugAsanCommandTable }, }; static std::vector<ChatCommand> commandTable = { @@ -1844,6 +1850,22 @@ public: return true; } + static bool HandleDebugOutOfBounds(ChatHandler* handler, CommandArgs* /*args*/) + { + 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]); + return true; + } + + static bool HandleDebugMemoryLeak(ChatHandler* handler, CommandArgs* /*args*/) + { + uint8* leak = new uint8(); + handler->PSendSysMessage("Leaked 1 uint8 object at address %p", leak); + return true; + } + static bool HandleDebugDummyCommand(ChatHandler* handler, CommandArgs* /*args*/) { handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing."); |