#debug vs release mode bug while casting to std::map

12 messages · Page 1 of 1 (latest)

brave lava
#

Hello, i have a code where i use casting to std::map to read std::map from memory the code:

std::map<int, Object*>* objectMap = reinterpret_cast<std::map<int, Object*>*>(*reinterpret_cast<__int64*>(
           *reinterpret_cast<__int64*>(Globals::baseAddress + ManagerAddress) + MapEntryAddress));
   for (auto current : *objectMap) {
       auto object = current.second;
       ...
}

And the problem is, the code works flawlessly when im testing it in debug mode but in release mode its never entering the for loop at all.. I tried to disable opitimization but it didn't help at all. Anyone have any idea what could be wrong there?

mighty spireBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

bleak shore
brave lava
#

Yes, as i said it works in debug mode flawlessly

bleak shore
#

If something works in debug but not release you most likely have UB in your code

brave lava
#

what does UB means

desert cradle
#

undefined behaviour

brave lava
#

hmmm i'll look into that then

stark stump
#

@brave lava prob cuz ur making a cheat and ur dll is using the wrong runtime libeaey in debug mode

bleak shore
#

bruh is he

celest abyss