Thread: Sandbot v0.3.1
View Single Post
Re: Sandbot v0.3.1
Old
  (#22)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Sandbot v0.3.1 - 25-02-2017

Could you give me a link to download working version of Gunman Chronicles for Steam?

Edit: I downloaded http://www.moddb.com/games/gunman-ch...-steam-version and installed Metamod-p 1.21p37 with Sandbot metamod branch and the game is running just fine.
Edit2: Oops, it seems that only the debug version is working. The release version is crashing the game lol.
Edit3: After some debugging I found out that it is a memory corruption issue. I actually located it. It is in the weapon message processing system for Gunman Chronicles - function BotClient_Gunman_WeaponList().
The bug is array overflow in bot_client.cpp:353, when accessing weapon_defs with bot_weapon.iId == 32. The array max index is 31, you are going out of bounds and some other memory gets modified which then causes undefined behavior. This is reproducible in both Metamod and non-metamod mode with the exception that in non-metamod mode the game is not crashing, because it seems that the invalid accessed memory is not critical at this state. As I said - this is undefined behavior.

The easiest fix here will be to increase the weapon_defs[] array from 32 to 33 but I cannot recommend that because 'MAX_WEAPONS' is from the HLSDK and is set to 32. Perhaps there is other way to parse the weapon messages for Gunman Chronicles?
Unfortunately you will have to find a proper fix for that yourself.

Last edited by The Storm; 03-03-2017 at 15:28..
  
Reply With Quote