Permalink
Browse files

test: read proper inspector message size

Fix a bug when messages bigger than 64kb where incorrectly parsed by
the inspector-helper.

PR-URL: #14596
Fixes: #14507
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
bzoz authored and MylesBorins committed Aug 2, 2017
1 parent 3a6392b commit 8b9a05c04bbe00aedf063754b13a1915caba68ca
Showing with 3 additions and 1 deletion.
  1. +3 −1 test/inspector/inspector-helper.js
@@ -48,6 +48,7 @@ function send(socket, message, id, callback) {
}
function parseWSFrame(buffer, handler) {
// Protocol described in https://tools.ietf.org/html/rfc6455#section-5
if (buffer.length < 2)
return 0;
assert.strictEqual(0x81, buffer[0]);
@@ -59,7 +60,8 @@ function parseWSFrame(buffer, handler) {
dataLen = buffer.readUInt16BE(2);
bodyOffset = 4;
} else if (dataLen === 127) {
dataLen = buffer.readUInt32BE(2);
assert(buffer[2] === 0 && buffer[3] === 0, 'Inspector message too big');
dataLen = buffer.readUIntBE(4, 6);
bodyOffset = 10;
}
if (buffer.length < bodyOffset + dataLen)

0 comments on commit 8b9a05c

Please sign in to comment.