ddnet/src/test
bors[bot] 14e70506e1
Merge #3535
3535: Fix a possible race in load code  r=def- a=heinrich5991

Previously, a save could possibly be loaded twice given enough latency
discrepancy between servers. The server only verified that it deleted
*some* save with the given password, not *the* save it is trying to
load. This is fixed by also checking the SaveID column that is random
and globally unique (except for the old NULLs). Since users can't create
new saves with NULL SaveID, these pose no problem.

Also change the default UUID for saves without save ID to something
nonzero, so we can't accidentally hit it due to a bug.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [x] Written a unit test if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] 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: heinrich5991 <heinrich5991@gmail.com>
2021-01-23 10:14:32 +00:00
..
aio.cpp Add manual locking to ASYNCIO for transacted writes 2017-11-27 01:04:55 +01:00
bezier.cpp Add some tests for the bezier stuff 2020-07-02 11:07:30 +02:00
blocklist_driver.cpp Remove failing blocklist_driver tests 2020-12-08 10:24:22 +01:00
color.cpp Run clang-format 2020-09-26 21:50:15 +02:00
csv.cpp Run clang-format 2020-09-26 21:50:15 +02:00
datafile.cpp Add support for extra map items in datafiles 2018-10-08 23:05:56 +02:00
fs.cpp Add CTestInfo class, add test for create-close-remove process 2017-10-23 00:13:53 +02:00
git_revision.cpp Use EXPECT_* rather than ASSERT_* in tests 2019-03-12 02:06:54 +01:00
hash.cpp Run clang-format 2020-09-26 21:50:15 +02:00
jobs.cpp Run clang-format 2020-09-26 21:50:15 +02:00
json.cpp Remove /modhelp (fixes #1401) 2018-12-12 10:05:44 +01:00
mapbugs.cpp Remove code for CRC in most places, except where needed for net compat 2020-10-14 17:08:58 +02:00
name_ban.cpp Use EXPECT_* rather than ASSERT_* in tests 2019-03-12 02:06:54 +01:00
packer.cpp Run clang-format 2020-09-26 21:50:15 +02:00
prng.cpp Run clang-format 2020-09-26 21:50:15 +02:00
str.cpp Add str_utf8_truncate test for size 0 2021-01-22 19:18:11 +01:00
strip_path_and_extension.cpp Add testing infrastructure for teehistorian 2017-09-28 02:03:30 +02:00
teehistorian.cpp Port CConfig API from the upstream (0.7.5) 2021-01-10 17:10:19 +03:00
test.cpp Call net_init in tests 2017-11-24 10:51:46 +01:00
test.h Add CTestInfo class, add test for create-close-remove process 2017-10-23 00:13:53 +02:00
thread.cpp Fix memory leak in Thread.Lock unit test 2021-01-22 19:18:25 +01:00
unix.cpp Add very basic test for Unix sockets 2017-12-20 16:56:44 +01:00
uuid.cpp Allow ParseUuid to report errors and add tests 2021-01-23 01:21:20 +01:00