Commit graph

19233 commits

Author SHA1 Message Date
Robert Müller 02f60421f9 Add validation for StrToInts and IntsToStr
Add strict validation for `StrToInts` function. Because this function should only be used with trusted internal strings, assertions are added to ensure that the string is not truncated. Some buffer sizes are adjusted accordingly, so truncation cannot happen.

Add less strict validation for `IntsToStr` function. An additional argument specifying the size of the output buffer is added to assert that the size of the output buffer is sufficient. However, because this function is used to decode data sent by the server and read from maps and ghosts, invalid input data should never result in crashes or invalid UTF-8 strings. The function will now unpack an empty string and return `false`, if the string contains invalid UTF-8.

The inline definition of the functions is not wanted, because it requires adding a `system.h` include in `gamecore.h`. Therefore the tools now have to depend on game-shared, which previously only worked because the functions were inline.

Tests are added to ensure the function still behaves the same as before for valid inputs and correctly handles invalid inputs.
2024-03-10 12:49:56 +01:00
heinrich5991 1afdf47362
Merge pull request #8072 from furo321/practice-helptext
List all practice commands when enabling `/practice`
2024-03-07 00:14:36 +00:00
furo 209df982f8 List all practice commands when enabling /practice 2024-03-07 00:57:21 +01:00
archimede67 de956c8db9
Merge pull request #8071 from dobrykafe/pr-popup-image-height
Editor: Make embedded image popup bigger at all times
2024-03-06 22:47:38 +00:00
dobrykafe 0b03bc7a16 make embedded image popup bigger at all times 2024-03-06 23:27:50 +01:00
Dennis Felsing 117ccd7adf
Merge pull request #8070 from Robyt3/Engine-FIFO-UTF8-Check
Ensure commands executed via FIFO are valid UTF-8
2024-03-06 22:12:02 +00:00
Robert Müller 3656c95eca Ensure commands executed via FIFO are valid UTF-8 2024-03-06 22:01:10 +01:00
Dennis Felsing b6689bc012
Merge pull request #8068 from heinrich5991/pr_ddnet_job_atomics
Fix race conditions in job state handling
2024-03-05 21:57:11 +00:00
heinrich5991 e7717f2265 Fix race conditions in job state handling
We want to change the state of the job from `STATE_QUEUED` to
`STATE_RUNNING`, but not from `STATE_ABORTED`. Previously, the code
usedd `exchange` to change the state and compared non-atomically
afterwards. This led to `STATE_ABORTED` being replaced by
`STATE_RUNNING` in a race. With `compare_exchange_strong`, this can no
longer happen.

Fixes #8044.
2024-03-05 20:55:44 +01:00
heinrich5991 819270c453
Merge pull request #8066 from Robyt3/Http-Error-Fixes
Fix HTTP client shutdown and deadlock on request error
2024-03-05 19:46:33 +00:00
Robert Müller 9323e18616 Fix HTTP client shutdown and deadlock on request error
Fix HTTP client effectively shutting down by entering the `ERROR` state when a request cannot be added. Now only the invalid request is aborted immediately. The `ERROR` state is now only entered when a curl function fails in a way where recovery is not possible.

Fix occasional deadlock when HTTP client is shutting down after entering the `ERROR` state, by also immediately aborting new requests when the HTTP client is already in the `ERROR` state.

Remove unused `CHttp::EState::STOPPING`.
2024-03-05 19:48:45 +01:00
Dennis Felsing f3de37d9d4
Merge pull request #8019 from heinrich5991/pr_ddnet_rename_variables
Rename all variables for strict camel-casing of abbreviations
2024-03-05 16:06:58 +00:00
heinrich5991 44bf0134f0
Merge pull request #8065 from dobrykafe/pr-solo-practice-bug
Fix practice mode not resetting after disconnect on solo servers
2024-03-05 15:20:34 +00:00
heinrich5991 17402cc43f Rename all variables for strict camel-casing of abbreviations
This is the strict version, ID → Id, UI → Ui, except DDNet which stays
DDNet.

This would fix #7750.

Done using a naive rename script (for bash, use `shopt -s globstar`):

```fish
sed -i \
	-e 's/\([a-z]_\?\)ID/\1Id/g' \
	-e 's/\([^ ]\)\<UI\>/\1Ui/g' \
	-e 's/UI()/Ui()/g' \
	-e 's/\<CUI\>/CUi/g' \
	-e 's/\([\ta-z.(&]\|[,=|] \)ID\>/\1Id/g' \
	-e 's/\<ID\>\([^ ").]\)/Id\1/g' \
	-e 's/\<ID\([0-9]\)/Id\1/g' \
	-e 's/\<ID\>\( [<=>:+*/-]\)/Id\1/g' \
	-e 's/int ID/int Id/g' \
	-e 's/\([a-z]_\?\)GPU/\1Gpu/g' \
	-e 's/\([a-z]_\?\)IP/\1Ip/g' \
	-e 's/\([a-z]_\?\)CID/\1Cid/g' \
	-e 's/\([a-z]_\?\)MySQL/\1Mysql/g' \
	-e 's/MySql/Mysql/g' \
	-e 's/\([a-xz]_\?\)SQL/\1Sql/g' \
	-e 's/DPMode/DpMode/g' \
	-e 's/TTWGraphics/TTwGraphics/g' \
	\
	-e 's/Ipointer/IPointer/g' \
	-e 's/\.vendorId/.vendorID/g' \
	-e 's/\.windowId/.windowID/g' \
	-e 's/SDL_GetWindowFromId/SDL_GetWindowFromID/g' \
	-e 's/SDL_AudioDeviceId/SDL_AudioDeviceID/g' \
	-e 's/SDL_JoystickId/SDL_JoystickID/g' \
	-e 's/SDL_JoystickInstanceId/SDL_JoystickInstanceID/g' \
	-e 's/AVCodecId/AVCodecID/g' \
	src/**/*.cpp src/**/*.h {datasrc,scripts}/**/*.py
git checkout -- src/engine/external
```

I like this option because it presents clear rules.

Still needs fixups because of the naive replacement, I'd do this if we
want this merged.
2024-03-05 15:44:09 +01:00
dobrykafe d94d020c25 fix practice mode not resetting after disconnect on solo servers 2024-03-05 14:08:30 +01:00
Dennis Felsing ca9f5dfcbe
Merge pull request #8064 from By622/patch-9
Update traditional_chinese.txt
2024-03-05 09:05:35 +00:00
By 888ac2f2d4
Update traditional_chinese.txt 2024-03-05 12:01:58 +08:00
heinrich5991 c15733eda3
Merge pull request #8063 from heinrich5991/pr_ddnet_register_error
Show error from masterserver in console
2024-03-04 23:08:25 +00:00
Dennis Felsing 3c6101ccb3
Merge pull request #8061 from dobrykafe/pr-czech-translations
Update Czech translations
2024-03-04 22:36:41 +00:00
heinrich5991 12409e545c Show error from masterserver in console
Allows people to see why masterserver registering failed.
2024-03-04 21:58:30 +01:00
heinrich5991 27467c658b
Merge pull request #8062 from Robyt3/Client-Command-Register-Cleanup
Remove remaining hard-coded server commands from client-side, hide `tune_zone` command in local console
2024-03-04 20:46:03 +00:00
Robert Müller dd94da67fb Hide tune_zone command in local console
Prevent the `tune_zone` command from being shown and used in the local console, which could cause issues with prediction, by only registering it as a game setting but not as a client command. The command callback is still correctly called when map settings are loaded in the `CGameClient::LoadMapSettings` function.
2024-03-04 21:26:47 +01:00
Robert Müller bfa5bc2b3c Remove remaining hard-coded server commands from client-side
Followup for #7919.
2024-03-04 21:26:41 +01:00
dobrykafe a8192c19a0 update czech translations 2024-03-04 20:43:47 +01:00
Dennis Felsing b88cdbf21e
Merge pull request #8055 from heinrich5991/pr_ddnet_no_duplicate_git_rev
Don't show the git revision twice in server log
2024-03-04 16:09:21 +00:00
heinrich5991 e851c78e47 Don't show the git revision twice in server log
Previously:
```
2024-03-03 12:17:40 I git-revision: 885ae7ecae
2024-03-03 12:17:40 I server: version 18.0.3 on linux amd64
2024-03-03 12:17:40 I server: git revision hash: 885ae7ecae
```
2024-03-04 16:50:45 +01:00
Dennis Felsing 7f08344aa8
Merge pull request #8054 from eghwand/turkish-1
Update turkish.txt
2024-03-04 10:15:22 +00:00
Dennis Felsing 93dc17a59f
Merge pull request #8052 from Bamcane/patch-5
Update simplified_chinese.txt
2024-03-04 10:04:57 +00:00
Egehan c0b5d089e2 Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:48:26 +01:00
Egehan 545e4df438 Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:48:26 +01:00
Egehan 8ecb7415d3 Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:48:26 +01:00
Egehan f3113e5136 Update turkish.txt 2024-03-04 10:48:26 +01:00
甘竹 Bamcane 57985cd8bd Update simplified_chinese.txt 2024-03-04 10:47:55 +01:00
Dennis Felsing 65a880a468
Merge pull request #8059 from n0Ketchp/patch-17
Update spanish.txt
2024-03-04 09:47:51 +00:00
noKetchup dde7b8a624
Update spanish.txt 2024-03-04 06:30:02 -03:00
Dennis Felsing 70eca3869a
Merge pull request #8051 from dobrykafe/pr-serverbrowser-friends-sort
Add sorting by number of friends to the server browser
2024-03-04 07:27:48 +00:00
Dennis Felsing b6cb7b112d
Merge pull request #8050 from gerdoe-jr/patch-1
Update russian.txt
2024-03-03 22:47:12 +00:00
Dennis Felsing a3e6a2dc50
Merge pull request #8056 from def-/pr-try-python-fix-macos
Try to fix python macOS issue
2024-03-03 22:46:58 +00:00
Dennis Felsing b0e9f5172d Try to fix python macOS issue
Fixes: #8053
2024-03-03 23:18:38 +01:00
Emir Marincic b031b7bdaa
Merge pull request #8057 from Robyt3/Skin-Trunc-Crash-Fix
Fix client crash due to truncated skin name
2024-03-03 18:26:50 +01:00
Robert Müller 6b3e16ea82 Fix client crash due to truncated skin name 2024-03-03 18:18:49 +01:00
dobrykafe 13f324ccf4 add sort by number of friends to server browser 2024-03-03 02:01:28 +01:00
Vladislav Gerasimov a68eacf500
Update russian.txt 2024-03-03 03:33:31 +03:00
Vladislav Gerasimov 9409d2e0f1
Update russian.txt 2024-03-03 03:11:51 +03:00
Dennis Felsing 885ae7ecae
Merge pull request #8049 from rffontenelle/patch-4
Update brazilian_portuguese.txt
2024-03-02 22:32:31 +00:00
Dennis Felsing e63cebfc5d
Merge pull request #8048 from furo321/swedish-18.1
Update Swedish translations for 18.1
2024-03-02 22:18:35 +00:00
Rafael Fontenelle 82b27c85b7
Update brazilian_portuguese.txt 2024-03-02 16:19:23 -03:00
furo 6ab99c4760 Update Swedish translations for 18.1 2024-03-02 18:22:06 +01:00
Robert Müller 9346aa9ea8
Merge pull request #8045 from def-/pr-18.1-transl
Update translations for upcoming 18.1
2024-03-02 13:42:18 +00:00
Dennis Felsing 66cc7b5e5b Update translations for upcoming 18.1 2024-03-02 14:09:33 +01:00