You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MessagePackHubProtocol.java reads a binary value's length prefix and allocates an array of that size before checking whether the message contains the declared number of bytes:
A small, malformed message can therefore cause an allocation much larger than its actual payload before parsing detects the missing data.
parseMessages validates the outer SignalR message length, but that does not validate length prefixes embedded within the MessagePack body. Its final consumed-byte check also occurs after the allocation.
Expected Behavior
Validate embedded lengths against the bytes remaining in the current SignalR message before allocating length-dependent buffers. Malformed or truncated values should be rejected without allocating their declared size.
Steps To Reproduce
Construct a SignalR invocation containing a binary argument whose MessagePack length prefix declares substantially more bytes than are present. Set the outer SignalR frame length to match the actual encoded body, and parse it with a binder expecting a byte[] argument.
The binary parsing branch allocates new byte[length] before readPayload discovers that the bytes are missing.
This reproduction is based on source inspection; it has not been executed.
Exceptions (if any)
The eventual exception depends on the declared length and available memory. No runtime exception output has been collected.
.NET Version
N/A — SignalR Java client.
Anything else?
The confirmed allocation site is the BINARY branch of readValue in MessagePackHubProtocol.java. Validation should respect the current message's boundary, not include bytes belonging to subsequent messages in the same buffer.
Activity