Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4769: Fix integer overflow in CHud when server time exceeds around 248 days r=def- a=Robyt3 Fixes the server timer in the HUD showing 00:00 when the server time exceeds around 248 days. Tested on "Vanilla Teeworlds Server - CTF": ![303d](https://user-images.githubusercontent.com/23437060/156249076-d3f20853-cd0a-4545-a459-493f123eb5bc.png) Otherwise connecting to this server causes: ``` /src/game/client/components/hud.cpp:128:17: runtime error: signed integer overflow: 26254443 * 100 cannot be represented in type 'int' #0 0x55c8b6722e7d in CHud::RenderGameTimer() /src/game/client/components/hud.cpp:128 #1 0x55c8b675cdfc in CHud::OnRender() /src/game/client/components/hud.cpp:855 #2 0x55c8b6babec7 in CGameClient::OnRender() /src/game/client/gameclient.cpp:598 #3 0x55c8b62b0330 in CClient::Render() /src/engine/client/client.cpp:1179 #4 0x55c8b6301a62 in CClient::Run() /src/engine/client/client.cpp:3155 #5 0x55c8b635fc34 in main /src/engine/client/client.cpp:4427 #6 0x7f581a6150b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #7 0x55c8b60f478d in _start (/build-asan/DDNet+0x1bd978d) ``` ## Checklist - [X] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [X] Changed no physics that affect existing maps - [X] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
- Loading branch information