Ensure max[Message|Frame]PayloadSize is int if auto-set
This commit is contained in:
Chris Boden 2021-12-06 20:04:04 -05:00 committed by GitHub
commit ebe17ed644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,10 +117,10 @@ class MessageBuffer {
$memory_limit_bytes = static::getMemoryLimit(); $memory_limit_bytes = static::getMemoryLimit();
if ($maxMessagePayloadSize === null) { if ($maxMessagePayloadSize === null) {
$maxMessagePayloadSize = $memory_limit_bytes / 4; $maxMessagePayloadSize = (int)($memory_limit_bytes / 4);
} }
if ($maxFramePayloadSize === null) { if ($maxFramePayloadSize === null) {
$maxFramePayloadSize = $memory_limit_bytes / 4; $maxFramePayloadSize = (int)($memory_limit_bytes / 4);
} }
if (!is_int($maxFramePayloadSize) || $maxFramePayloadSize > 0x7FFFFFFFFFFFFFFF || $maxFramePayloadSize < 0) { // this should be interesting on non-64 bit systems if (!is_int($maxFramePayloadSize) || $maxFramePayloadSize > 0x7FFFFFFFFFFFFFFF || $maxFramePayloadSize < 0) { // this should be interesting on non-64 bit systems