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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user