1
0
mirror of synced 2026-10-24 00:28:57 +03:00

fix: cast len to 64 bits before right shift in ws (#2426)

Fixes WebSocketIntegrationTest.LargeMessage and
WebSocketIntegrationTest.MaxPayloadAtLimit on i386
This commit is contained in:
Andrea Pappacoda
2026-04-12 23:27:16 +02:00
committed by GitHub
parent 7e2a173072
commit cb3fce964d

View File

@@ -4727,7 +4727,8 @@ inline bool write_websocket_frame(Stream &strm, ws::Opcode opcode,
if (strm.write(reinterpret_cast<char *>(header), 2) < 0) { return false; }
uint8_t ext[8];
for (int i = 7; i >= 0; i--) {
ext[7 - i] = static_cast<uint8_t>((len >> (i * 8)) & 0xFF);
ext[7 - i] =
static_cast<uint8_t>((static_cast<uint64_t>(len) >> (i * 8)) & 0xFF);
}
if (strm.write(reinterpret_cast<char *>(ext), 8) < 0) { return false; }
}