mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-17 10:59:39 +00: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:
1 parent
7e2a173072
commit
cb3fce964d
1 file changed
+2
-1
@@ -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; }
|
if (strm.write(reinterpret_cast<char *>(header), 2) < 0) { return false; }
|
||||||
uint8_t ext[8];
|
uint8_t ext[8];
|
||||||
for (int i = 7; i >= 0; i--) {
|
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; }
|
if (strm.write(reinterpret_cast<char *>(ext), 8) < 0) { return false; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user