Commit graph

18538 commits

Author SHA1 Message Date
Dennis Felsing addb3c6980
Merge pull request #7616 from Robyt3/Snapshot-Storage-Separate-Alloc
Separate snapshot storage holder and snap data allocations
2023-12-09 21:45:45 +00:00
Robert Müller 7ae7877248
Merge pull request #7593 from archimede67/console-scrolling
Add ability to scroll in console. Remove pages.
2023-12-09 18:26:32 +00:00
Robert Müller d3cc932a9b
Merge pull request #7393 from archimede67/editor-undo-redo-v2
Editor undo/redo v2
2023-12-09 18:17:38 +00:00
Robert Müller efc451324d Separate snapshot storage holder and snap data allocations
Previously, only one buffer was allocated to store each snapshot holder structure, the snapshot data and alternative snapshot data. This prevents tools like ASAN from detecting some invalid accesses, e.g. to the snapshot holder structure by underflowing the snapshot data pointer. Now three separate allocations are used instead. This hopefully helps debugging #2677.
2023-12-09 19:03:07 +01:00
Dennis Felsing 3b58f868d5
Merge pull request #7508 from def-/pr-revert-compat
Revert "Add flags for compatibility with Windows 8 - 11"
2023-12-09 17:29:31 +00:00
Dennis Felsing 63710e91e8
Merge pull request #7601 from ChillerDragon/pr_fix_authstate_id
Use real ClientID to lookup authed state
2023-12-09 17:26:48 +00:00
furo e0b51c2aec Add ability to scroll in console. Remove pages. 2023-12-09 12:20:43 +01:00
heinrich5991 0c33be1692
Merge pull request #7604 from Robyt3/Endianness-Check
Add compile time errors for unsupported endianness
2023-12-08 16:13:17 +00:00
Robert Müller 30df38f926 Add compile time errors for unsupported endianness
We support little and big endian but not PDP endian (Middle-endian).

Define endianness as string `CONF_ARCH_ENDIAN_STRING` to avoid conditional compilation when printing endianness.
2023-12-08 16:57:01 +01:00
heinrich5991 f9dc1f5284
Merge pull request #7606 from Robyt3/Base-TOS-Error-Fix
Avoid setting `IP_TOS` on IPv6 sockets on Windows, fix incorrect error code logged in socket warnings
2023-12-08 12:28:34 +00:00
Jupeyy 6a858287e9
Merge pull request #7600 from Robyt3/Unpacker-Regression-Fix
Fix incorrect map being loaded/downloaded
2023-12-07 20:52:30 +00:00
Robert Müller 14c95a65f3 Avoid setting IP_TOS on IPv6 sockets on Windows
As this does not work and always causes the error message to be printed. See #7605.
2023-12-07 21:43:42 +01:00
Robert Müller a927eee53e Fix incorrect error code logged in socket warnings
On Windows the function `setsockopt` does not set `errno` on errors but instead `WSAGetLastError` must be used. This is encapsulated in the `net_errno` function.
2023-12-07 21:43:42 +01:00
Robert Müller 48805a6db4
Merge pull request #7596 from archimede67/fix-chat-preview-update
Fix chat preview update
2023-12-07 19:44:46 +00:00
Corantin H 2dd917f4c0 Update preview lines instead of initializing them only once 2023-12-07 19:20:24 +01:00
ChillerDragon f8ca16c50e Use real ClientID to lookup authed state and score
The variable `Id` is translated for old clients and is not guranteed to
be the real id. While `m_ClientID` is the real ID. That can also be used
to index the CServer::m_aClients[] array to get the authed state.

closed #7599

Fixes

```
valgrind ./DDNet-Server "dbg_dummies 1"
[..]
2023-12-07 18:01:33 I chat: *** 'Debug dummy 1' entered and joined the
game
==75634== Conditional jump or move depends on uninitialised value(s)
==75634==    at 0x2DAA83: CVariableInt::Pack(unsigned char*, int, int)
(compression.cpp:17)
==75634==    by 0x2DAD79: CVariableInt::Compress(void const*, int,
void*, int) (compression.cpp:98)
==75634==    by 0x23EC50: CServer::DoSnapshot() (server.cpp:1046)
==75634==    by 0x247D2D: CServer::Run() (server.cpp:2994)
==75634==    by 0x230173: main (main.cpp:193)
==75634==
==75634== Conditional jump or move depends on uninitialised value(s)
==75634==    at 0x2DAAF7: CVariableInt::Pack(unsigned char*, int, int)
(compression.cpp:25)
==75634==    by 0x2DAD79: CVariableInt::Compress(void const*, int,
void*, int) (compression.cpp:98)
==75634==    by 0x23EC50: CServer::DoSnapshot() (server.cpp:1046)
==75634==    by 0x247D2D: CServer::Run() (server.cpp:2994)
==75634==    by 0x230173: main (main.cpp:193)
==75634==
==75634== Conditional jump or move depends on uninitialised value(s)
==75634==    at 0x2DAA83: CVariableInt::Pack(unsigned char*, int, int)
(compression.cpp:17)
==75634==    by 0x32E812: CPacker::AddInt(int) (packer.cpp:20)
==75634==    by 0x23ED51: CServer::DoSnapshot() (server.cpp:1059)
==75634==    by 0x247D2D: CServer::Run() (server.cpp:2994)
==75634==    by 0x230173: main (main.cpp:193)
==75634==
==75634== Conditional jump or move depends on uninitialised value(s)
==75634==    at 0x2DAAF7: CVariableInt::Pack(unsigned char*, int, int)
(compression.cpp:25)
==75634==    by 0x32E812: CPacker::AddInt(int) (packer.cpp:20)
==75634==    by 0x23ED51: CServer::DoSnapshot() (server.cpp:1059)
==75634==    by 0x247D2D: CServer::Run() (server.cpp:2994)
==75634==    by 0x230173: main (main.cpp:193)
==75634==
```

Which is using ID 0 as index in the m_aClients array but only ID 63 was
ever initialized.
2023-12-07 18:40:16 +01:00
Robert Müller 8b8ce652db
Merge pull request #7594 from rffontenelle/patch-3
Update brazilian_portuguese.txt
2023-12-07 16:53:43 +00:00
Robert Müller 6b547b1388 Fix incorrect map being loaded/downloaded
The `LoadMapSearch` function returns an error message or `nullptr` on success but the condition was incorrectly changed in #7580 so the opposite was checked instead.

Closes #7597.
2023-12-07 17:46:58 +01:00
heinrich5991 65641763c1
Merge pull request #7591 from Robyt3/Editor-Sound-Invalid-Index
Fix incorrect sound index usage for editor sound preview
2023-12-06 11:22:00 +00:00
heinrich5991 20a636d0d4
Merge pull request #7590 from Robyt3/UI-Popup-Open-Close-Fix
Fix heap-use-after-free when popup opens another popup
2023-12-06 11:18:38 +00:00
Rafael Fontenelle 40bfbf2dd0
Update brazilian_portuguese.txt 2023-12-05 17:01:40 -03:00
heinrich5991 f52aa8a61c
Merge pull request #7592 from Robyt3/Protocol-VoteTime-Fix
Fix votes with timeout over 60 seconds not being shown in client
2023-12-05 19:34:41 +00:00
Robert Müller b738f5f9ce Fix votes with timeout over 60 seconds not being shown in client
Setting a vote timeout longer than 60 seconds with `sv_vote_time` caused the vote network messages to be discarded with the error message `weird message 'Sv_VoteSet' (15), failed on 'm_Timeout'` by the client, as the protocol did not allow longer vote timeouts.

This changes the protocol so the vote timeout can be any positive integer although for now the maximum `sv_vote_time` value is changed back to 60 again to preserve compatibility with old clients.

Closes #7583.
2023-12-05 20:12:15 +01:00
heinrich5991 801274ac63
Merge pull request #7580 from Robyt3/Message-Unpack-Check
Add missing unpacker error checks for server and client packets
2023-12-05 19:01:33 +00:00
Robert Müller 4ad0a48a48 Add missing unpacker error checks for server and client packets
Ensure all packets are unpacked correctly before using the unpacked data.

Ensure strings are valid UTF-8 in `CUnpacker::GetString`.
2023-12-05 19:40:27 +01:00
heinrich5991 3607e8e0f2
Merge pull request #7581 from Robyt3/Snapshot-Refactoring
Various minor refactoring of snapshot-related code
2023-12-05 00:36:40 +00:00
heinrich5991 da6dbc9da8
Merge pull request #7582 from Robyt3/Kernel-Refactoring
Support arbitrary number of kernel interfaces, assert on errors
2023-12-05 00:34:33 +00:00
Corantin H 96e4c5f7cd Add editor undo/redo feature 2023-12-04 22:44:20 +01:00
Robert Müller 7e8c2aa4be Fix incorrect sound index usage for editor sound preview
The invalid sound index is `-1` but the check in the editor for the sound preview assumed it was `0`. We should use a type-safe wrapper to avoid this in the future, like for texture handles.
2023-12-04 22:21:53 +01:00
Robert Müller d8ec6a0a35 Fix heap-use-after-free when popup opens another popup
The popup menu render function can open/close other popups, which may resize the vector of popup menus and thus invalidate the current popup menu variable before the popup is closed. We therefore store the popup UI element ID in a separate variable to avoid the access to the potentially invalidated popup menu variable after the popup menu is rendered.

Also prevent invalidated popup menu from being rendered for one frame after it is closed by clicking outside.

Closes #7565.
2023-12-04 22:12:20 +01:00
Robert Müller 0c6978f553 Support arbitrary number of kernel interfaces, assert on errors
Support registering arbitrary number of interfaces with `IKernel` instead at most 32.

Assert when incorrect arguments are passed to `IKernel` functions instead of returning a `bool`, which was not being handled in all cases. These functions are not expected to fail expect on programming errors.

Consistently order and format creation and registration of kernel interfaces in client and server.
2023-12-04 18:11:47 +01:00
Robert Müller 0ff2c5b772 Use size_t and add assertions for CSnapshotStorage::Add 2023-12-04 17:59:40 +01:00
Robert Müller f5ed4159b7 Mark functions and pointers as const 2023-12-04 17:59:40 +01:00
Robert Müller 0472808561 Add assertions for CSnapshotDelta::SetStaticsize parameters 2023-12-04 17:59:40 +01:00
Robert Müller 8f9a44514f Remove unnecessary RangeCheck function 2023-12-04 17:59:39 +01:00
Robert Müller f910ac6a1c
Merge pull request #7587 from heinrich5991/pr_ddnet_fix_7575
Reintroduce `m_HaveGlobalTcpAddr`
2023-12-04 08:57:04 +00:00
Robert Müller 9e3d7c47fb
Merge pull request #7586 from heinrich5991/pr_ddnet_invalid_utf16_error
Make error message about invalid UTF-16 more precise
2023-12-04 08:56:35 +00:00
heinrich5991 a9ccc6956b Make error message about invalid UTF-16 more precise
Error out on invalid UTF-16 in locale name
2023-12-04 03:08:37 +01:00
heinrich5991 dc6893ef28 Make dbg_assert take a boolean 2023-12-04 03:02:05 +01:00
heinrich5991 a0d8c6c3c6 Reintroduce m_HaveGlobalTcpAddr
CC #7575
2023-12-04 02:52:48 +01:00
Chairn 0ffab44dea
Merge pull request #7585 from ChillerDragon/pr_optional_tele
Make intersect TeleNr arg optional
2023-12-03 20:58:25 +00:00
ChillerDragon a0736e4f24 Make intersect TeleNr arg optional
gets rid of the need to define a unused variable
2023-12-03 21:36:45 +01:00
Robert Müller 93d669143d Use nullptr instead of 0 and 0x0 2023-12-03 12:15:22 +01:00
Robert Müller 026ddc3f3a Extract common expression in variable pSnapshot 2023-12-03 12:15:22 +01:00
Dennis Felsing 07fd8c1a48
Merge pull request #7576 from furo321/favourite-with-prefix
Fix bug when using favourites in combination with prefixes.
2023-12-02 22:35:30 +00:00
Dennis Felsing e0d0daaae0
Merge pull request #7575 from Robyt3/Client-MemZero-Fix
Properly initialize all `CClient` member variables, improve integration test script
2023-12-02 22:30:52 +00:00
furo 732b213c09 Fix bug when using favourites in combination with prefixes. 2023-12-02 18:49:15 +01:00
Robert Müller d70fc84e38 Properly initialize all CClient member variables
Additionally, ensure snapshots are cleared and dummy is disconnected when disconnecting programatically with `DisconnectWithReason`.

Add `NETADDR_ZEROED` and `UUID_ZEROED` for more convenient initialization without using `mem_zero`.
2023-12-02 18:33:46 +01:00
Robert Müller b352545621 Improve integration test script
Fix valgrind errors not being detected as failures when the tests otherwise finish, as the valgrind results are printed to stderr and not to the logfiles. Additionally, valgrind failures were not being detected because the error summary is not printed to stderr immediately but only after some time when valgrind has processed the summary.

Find random unused port to bind to by opening a socket on port 0 and closing it immediately. This gives a port that will very likely be unused because the system cycles through all ports before reusing old ones obtained this way.

Add `wait_for_launch` function to reduce duplicate code. Wait for server to launch before starting clients.

Improve log messages.
2023-12-02 18:33:46 +01:00
Robert Müller f9fc85920f
Merge pull request #7572 from furo321/fix-server-demos
Stop all recording of server demos on shutdown.
2023-12-02 11:29:13 +00:00