fix(Core/Misc): prevent crash and undefined behavior in Warden destructor and Object visibility (#24900)

This commit is contained in:
Francesco Borzì
2026-03-05 12:41:08 +01:00
committed by GitHub
parent 5a3c48b281
commit b1d159c225
3 changed files with 19 additions and 12 deletions
+6 -3
View File
@@ -38,9 +38,12 @@ Warden::Warden() : _session(nullptr), _checkTimer(10000/*10 sec*/), _clientRespo
Warden::~Warden()
{
delete[] _module->CompressedData;
delete _module;
_module = nullptr;
if (_module)
{
delete[] _module->CompressedData;
delete _module;
_module = nullptr;
}
_initialized = false;
}
+5 -2
View File
@@ -72,9 +72,12 @@ ClientWardenModule* WardenMac::GetModuleForClient()
{
auto mod = new ClientWardenModule;
uint32 length = Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.size();
// data assign
mod->CompressedSize = Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.size();
mod->CompressedData = Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.data();
mod->CompressedSize = length;
mod->CompressedData = new uint8[length];
memcpy(mod->CompressedData, Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.data(), length);
// md5 hash
mod->Id = Acore::Crypto::MD5::GetDigestOf(mod->CompressedData, mod->CompressedSize);