aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-08-17 22:54:39 +0200
committerTreeston <treeston.mmoc@gmail.com>2020-08-17 22:54:39 +0200
commit0b13fc192698f65cc6e338ef92c22d4d783281b9 (patch)
tree1bddc5fe423612950f8917f04847016169215c3b /src
parent76f309b4e899d4f450a8448d49c1aa05f9d4e785 (diff)
Scripts/Commands: Revert e18f7aa, re-add .debug asan outofbounds, move bodies to #ifdef
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 5b6b85490d4..b4775d94857 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -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;
}