1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-10-01 08:44:05 +02:00
Commit graph

24 commits

Author SHA1 Message Date
Peter
56f0856441 Write protocol dependent lengths when encoding
CreateStringTable and TempEntities both read their payload length as a fixed
width field on protocol 23 and older and as a var int after that, but the
encoders always write the var int. Reencoding an older demo therefore hands
the game a length it can't read: string tables come back as "bogus substring
index", and any packet carrying temp entities is malformed from there on,
taking whatever messages follow it in that packet with it.

The threshold and both widths are taken from the read paths a few lines up in
these same two files rather than worked out separately, so the two sides can't
drift: > 23, with 20 bits for CreateStringTable and 17 for TempEntities. The
engine agrees, for what it's worth - netmessages.cpp reads both of these under
> PROTOCOL_VERSION_23 at NET_MAX_PAYLOAD_BITS_V23 + 3 and
NET_MAX_PAYLOAD_BITS_V23 respectively, and that constant is 17.

serverinfo and prefetch already branch on the protocol on both sides, these
two were the only ones that didn't.

On a protocol 15 demo that was 28909 of 92518 reencoded packets failing to
parse back; on test_data/protocol23.dem, 13220 of 43327. Both are zero now,
so protocol23.dem can join the reencode round trip test. Protocol 24 output
is unchanged, byte for byte.
2026-08-31 11:58:21 +01:00
fbaca025b6 feature gate write support, use hash to compare game event definitions 2025-07-15 16:06:23 +02:00
6ef2b1cea8 remove some bounds checks 2025-07-14 14:56:14 +02:00
1d71aa8ba6 remove some slice indexing 2024-04-07 16:48:19 +02:00
a7a46384ce additional hardening against mallformed demos 2022-12-13 22:06:07 +01:00
614dbb2f47 more tracing 2022-06-08 15:30:34 +02:00
64b66a770c smaller baselines 2022-04-22 20:47:33 +02:00
ec57a76101 baseline stuff 2022-04-16 14:30:59 +02:00
099c2d33b9 packet clone 2021-07-27 22:53:18 +02:00
93b51bff70 schemars 2021-07-25 17:26:53 +02:00
43b7270fcd wip 2021-07-25 17:04:50 +02:00
03f8b8a424 add serde support for packets 2021-07-25 15:09:36 +02:00
522b282962 remove the need for full reserve 2021-07-24 16:05:23 +02:00
5c10c9e6ae parse and encode tempentities 2021-07-23 18:45:00 +02:00
3055242fd9 fix tempentities for protocol version 23 2021-07-23 17:30:32 +02:00
577a998baa entity write fixes 2021-07-20 19:27:24 +02:00
bfd6d8caf9 sendprop writing 2021-07-19 19:53:51 +02:00
34533a9608 write TempEntitiesMessage 2021-07-18 21:41:06 +02:00
a4ddd586dd borrowed data 2020-12-06 00:55:54 +01:00
ff18680a02 sendprop decoding 2019-08-10 22:57:07 +02:00
128bf1ceb2 skip messages we dont care about 2019-03-17 18:44:33 +01:00
9f622385ca cleanup 2019-03-06 22:20:51 +01:00
f2650dc32f format 2019-03-02 22:33:22 +01:00
8d053296ca message work 2019-03-02 16:42:04 +01:00