nosoop / rcbot2

A Metamod:Source plugin that provides customizable bot players.
http://rcbot.bots-united.com
GNU Affero General Public License v3.0
5 stars 0 forks source link

Crash on null sv_gravity pointer in getGrenadeZ #13

Closed nosoop closed 3 years ago

nosoop commented 4 years ago

Odd bug. The following line is reported to crash on Windows due to an invalid access in ConVar::GetFloat():

https://github.com/nosoop/rcbot2/blob/000a20d1881c83a81685aa5ea140c5820f0cf264/utils/RCBot2_meta/bot_task.cpp#L97

Not sure if there's any way to reproduce this.

nosoop commented 4 years ago

The weird thing is that other nearby functions have a non-null check for sv_gravity:

https://github.com/nosoop/rcbot2/blob/000a20d1881c83a81685aa5ea140c5820f0cf264/utils/RCBot2_meta/bot_task.cpp#L3702-L3707

The baffling part is why sv_gravity isn't valid in the first place — it gets assigned once and shouldn't be accessed any further. The convar is valid for TF2, and in my tests the ConVar resolves to a valid address.

My goal here is to not need that null check at all.

nosoop commented 3 years ago

This may be fixed with 5392e435e055dd997c5f934b853c6e912d940b10. Not 100% sure, though.