fix(client): fix MessagePack int_64 encoder dead code branch (#516)

The int_64 branch condition `-(1 << 63) <= value` overflowed in
GDScript's signed 64-bit arithmetic, making the branch unreachable.
Negative values beyond int_32 range were incorrectly encoded as
uint_64 (0xcf) instead of int_64 (0xd3). Replaced with `value < 0`.

Updated boundary tests BV-N15 and BV-N16 to expect correct int_64
header byte.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 02:14:29 +01:00
co-authored by Claude Opus 4.6
parent 58072bc119
commit 1435a77dcc
2 changed files with 7 additions and 13 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ static func _encode_message(buffer: StreamPeerBuffer, value):
elif 0 <= value and value <= (1 << 32) - 1:
buffer.put_u8(types["uint_32"])
buffer.put_u32(value)
elif - (1 << 63) <= value and value < (1 << 63):
elif value < 0:
buffer.put_u8(types["int_64"])
buffer.put_64(value)
else: