Fix incomplete Teehistorian chunks being written

Save/Load code are up to 65536 bytes long. However, Packer only has a
buffer of 2048 bytes. Writing SAVE_SUCCESS and LOAD_SUCCESS chunks
likely for saves with 3 or more tees.

This increases the buffer size for all packing including networking
packets and is therefore probably not the optimal solution. An
alternative would be to create an additional packer CLargePacker or make
the size a template argument.

The suggested change is the simplest fix adding not much complexity, but
increases the chance of overrunning the stack size. I'm open to take
another approach.
This commit is contained in:
Zwelf 2024-11-09 22:27:53 +01:00
parent d0fc4af9fb
commit 1b6e5a9295
3 changed files with 3 additions and 3 deletions

View file

@ -8,7 +8,7 @@ class CPacker
public:
enum
{
PACKER_BUFFER_SIZE = 1024 * 2
PACKER_BUFFER_SIZE = 1024 * 64
};
private:

View file

@ -10,7 +10,7 @@
static const char TEEHISTORIAN_NAME[] = "teehistorian@ddnet.tw";
static const CUuid TEEHISTORIAN_UUID = CalculateUuid(TEEHISTORIAN_NAME);
static const char TEEHISTORIAN_VERSION[] = "2";
static const char TEEHISTORIAN_VERSION_MINOR[] = "8";
static const char TEEHISTORIAN_VERSION_MINOR[] = "9";
#define UUID(id, name) static const CUuid UUID_##id = CalculateUuid(name);
#include <engine/shared/teehistorian_ex_chunks.h>

View file

@ -105,7 +105,7 @@ protected:
void Expect(const unsigned char *pOutput, size_t OutputSize)
{
static CUuid TEEHISTORIAN_UUID = CalculateUuid("teehistorian@ddnet.tw");
static const char PREFIX1[] = "{\"comment\":\"teehistorian@ddnet.tw\",\"version\":\"2\",\"version_minor\":\"8\",\"game_uuid\":\"a1eb7182-796e-3b3e-941d-38ca71b2a4a8\",\"server_version\":\"DDNet test\",\"start_time\":\"";
static const char PREFIX1[] = "{\"comment\":\"teehistorian@ddnet.tw\",\"version\":\"2\",\"version_minor\":\"9\",\"game_uuid\":\"a1eb7182-796e-3b3e-941d-38ca71b2a4a8\",\"server_version\":\"DDNet test\",\"start_time\":\"";
static const char PREFIX2[] = "\",\"server_name\":\"server name\",\"server_port\":\"8303\",\"game_type\":\"game type\",\"map_name\":\"Kobra 3 Solo\",\"map_size\":\"903514\",\"map_sha256\":\"0123456789012345678901234567890123456789012345678901234567890123\",\"map_crc\":\"eceaf25c\",\"prng_description\":\"test-prng:02468ace\",\"config\":{},\"tuning\":{},\"uuids\":[";
static const char PREFIX3[] = "]}";