azerothcore / mod-autobalance

Module for AzerothCore(MaNGOS -> TrinityCore -> SunwellCore)
http://www.azerothcore.org
103 stars 109 forks source link

Bug: worldserver crash when a player create a character with wrong race and class #166

Closed vitsumoc closed 1 year ago

vitsumoc commented 1 year ago

Current Behaviour

I use a latest version of AzerothCore, here is my server info: AzerothCore rev. https://github.com/azerothcore/azerothcore-wotlk/commit/2217563fb1dc5143e3a9c386642f812dc2997465 2023-10-20 12:50:59 +0000 (master branch) (Unix, RelWithDebInfo, Static)

when a user use a modified client, and try to create a Orc Mage(Normally this is not possible), the worldserver will crash, an this is the end of the logfile. image

here is the crash log:

Expected Behaviour

Character creation failed user be kick out

Steps to reproduce the problem

  1. downlaod the patch link:https://pan.baidu.com/s/1SR559ws1YtXxHnrGI3qUNw code:l5kl

  2. copy the path to client

  3. login an create a orc mage

Extra Notes

No response

AutoBalance Debug Commands

No response

AC rev. hash/commit

AzerothCore rev. https://github.com/azerothcore/azerothcore-wotlk/commit/2217563fb1dc5143e3a9c386642f812dc2997465 2023-10-20 12:50:59 +0000 (master branch) (Unix, RelWithDebInfo, Static) Connected players: 24. Characters in world: 22. Connection peak: 33. Server uptime: 1 day(s) 30 minute(s) 16 second(s) Update time diff: 9ms, average: 8ms. Using SSL version: OpenSSL 3.0.2 15 Mar 2022 (library: OpenSSL 3.0.2 15 Mar 2022) Using Boost version: 1.74.0 Using CMake version: 3.22.1 Using MySQL version: 100612 Found MySQL Executable: /usr/bin/mysql Compiled on: Linux 5.15.0-87-generic Worldserver listening connections on port 8085 Realmlist (Realm Id: 1) configured in port 8085 VMAPs status: Enabled. LineOfSight: 1, getHeight: 1, indoorCheck: 1 MMAPs status: Enabled maps directory located in /home/vc/azeroth-data/maps. Total size: 291014951 bytes vmaps directory located in /home/vc/azeroth-data/vmaps. Total size: 658130721 bytes mmaps directory located in /home/vc/azeroth-data/mmaps. Total size: 2192910844 bytes Default DBC locale: enUS. All available DBC locales: enUS Using World DB: ACDB 335.10-dev Latest LoginDatabase update: 2023_04_24_00.sql Latest CharacterDatabase update: trasmorg.sql Latest WorldDatabase update: trasm_world_texts.sql LoginDatabase queue size: 0 CharacterDatabase queue size: 0 WorldDatabase queue size: 0

List enable modules:

mod-autobalance mod-eluna mod-progression-system mod-solo-lfg mod-transmog

Operating system

Ubuntu 22.04.2 LTS

Custom changes or Modules

No response

Fireevil commented 1 year ago

It won't let me register on the page to download the patch, could you put the patch in a direct link to test?

vitsumoc commented 1 year ago

ok, here is a direct link

http://shayizhaocai.xyz:13055/patch-zhCN-Z.MPQ

kjack9 commented 1 year ago

So you've modified the client to do something it's not supposed to, and now it crashes. As far as I know, you can't just create invalid characters on the client side and have the server be okay with that. None of your modules are handling non-standard characters.

Does this happen without AutoBalance enabled too? What is leading you to believe that AutoBalance specifically is causing this crash?

vitsumoc commented 1 year ago

Because we have discussed this problem in the azerothcore-wotlk issue before and tested it. When whithout the AutoBalance module , there will be no problem. When with the AutoBalance module, the problem will occur.

https://github.com/azerothcore/azerothcore-wotlk/issues/17577

kjack9 commented 1 year ago

Got it, thank you for the link to the other issue - that is helpful.

I have no idea why an invalid class/race combination would specifically cause this - AutoBalance doesn't care at all about either of those things. I expect that something in AC handles it differently before it gets to me.

Let's try adding some checks for the function that crashed. Can you please try this branch and let me know if that fixes the issue for you?

vitsumoc commented 1 year ago

Ok, I've tried this branch and got the same crash.

image

here is the crash log:

https://gist.github.com/Vitumoc/d1a248269f4c5e7b76607f0ea5d4fe25

Will this help us solve this problem? Is there anything else I need to do?

kjack9 commented 1 year ago

You are not using my updated issue branch.

0007FF676A6CA17 000000D1898FDC30 AutoBalance_PlayerScript::OnPlayerLeaveCombat+47 C:\Users\vc\Documents\ac\azerothcore\modules\mod-autobalance\src\AutoBalance.cpp line 3653

Doesn't line up with

https://github.com/kjack9/mod-autobalance/blob/1c22e9b87e7c475cfeb0d35b01067471e08dad9a/src/AutoBalance.cpp#L3653

Can you try to download the issue branch from this link and compile again please?

vitsumoc commented 1 year ago

I'm trying the branch, but there is an error during compilation.

image

25> Creating library C:/Users/vc/Documents/ac/build/src/server/apps/RelWithDebInfo/worldserver.lib and object C:/Users/vc/Documents/ac/build/src/server/apps/RelWithDebInfo/worldserver.exp 25>modules.lib(ModulesLoader.obj) : error LNK2019: unresolved external symbol "void cdecl Addmod_autobalance_kjack9_issue166Scripts(void)" (?Addmod_autobalance_kjack9_issue166Scripts@@YAXXZ) referenced in function "void cdecl AddModulesScripts(void)" (?AddModulesScripts@@YAXXZ) 25>C:\Users\vc\Documents\ac\build\bin\RelWithDebInfo\worldserver.exe : fatal error LNK1120: 1 unresolved externals 25>Done building project "worldserver.vcxproj" -- FAILED. 26>------ Rebuild All started: Project: ALL_BUILD, Configuration: RelWithDebInfo x64 ------ 26>Building Custom Rule C:/Users/vc/Documents/ac/azerothcore/CMakeLists.txt ========== Rebuild All: 25 succeeded, 1 failed, 0 skipped ========== ========== Rebuild started at 9:23 and took 06:44.834 minutes ==========

kjack9 commented 1 year ago

Rename the folder to mod-autobalance.

vitsumoc commented 1 year ago

thank you, I have tested this branch

here is the crash log: https://gist.github.com/Vitumoc/d181445fd06bbb9072b1b3829b4beddc

kjack9 commented 1 year ago

Thanks, that helps.

I think I've done all the checking I can before I make that GetMap() call. I made sure the player exists and then called a function that player. The function that's actually failing is inside GetMap(), so I don't think I can fix this from AutoBalance.

Let me leave some findings over on the other bug and see if anyone is able to help there. I am... 85% sure this is a bug with Azerothcore, not AutoBalance.

kjack9 commented 1 year ago

https://github.com/azerothcore/azerothcore-wotlk/issues/17577#issuecomment-1786725790