PazerOP / tf2_bot_detector

Automatically detects and votekicks cheaters/bots in TF2 casual.
MIT License
403 stars 54 forks source link

[BUG] Custom chat_<language>.txt files can be changed to UTF-8 causing crashes #321

Open andy013 opened 3 years ago

andy013 commented 3 years ago

Sometimes chat_<language>.txt files within the custom folders get changed to UTF-8 encoding. This will cause the bot detector to crash on opening. I'm not sure if it's TF2 that is changing the encoding or the bot detector or something else.

To reproduce you can just put a chat_english.txt file in tf/custom/my_mod/resource and make sure it's saved as UTF-8.

I think it might be this part of the code that is causing the crash by failing to check the file encoding is correct:

https://github.com/PazerOP/tf2_bot_detector/blob/881f0cefdef3a9281f3a5297cdc30c3e0cb1875d/tf2_bot_detector/Config/ChatWrappers.cpp#L381-L382

Why the files are changing to UTF-8, I have no idea. I thought it might have been when the bot detector crashed in the middle of accessing the file but I checked my logs and it seems like I had a graceful shut down right before it happened.