We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e7bc38 commit d7afeb2Copy full SHA for d7afeb2
src/java/nginx/unit/websocket/WsFrameBase.java
@@ -260,6 +260,13 @@ private boolean processRemainingHeader() throws IOException {
260
} else if (payloadLength == 127) {
261
payloadLength = byteArrayToLong(inputBuffer.array(),
262
inputBuffer.arrayOffset() + inputBuffer.position(), 8);
263
+ // The most significant bit of those 8 bytes is required to be zero
264
+ // (see RFC 6455, section 5.2). If the most significant bit is set,
265
+ // the resulting payload length will be negative so test for that.
266
+ if (payloadLength < 0) {
267
+ throw new WsIOException(
268
+ new CloseReason(CloseCodes.PROTOCOL_ERROR, sm.getString("wsFrame.payloadMsbInvalid")));
269
+ }
270
inputBuffer.position(inputBuffer.position() + 8);
271
}
272
if (Util.isControl(opCode)) {
0 commit comments