Skip to content

Commit 0238d73

Browse files
committed
dont check frame max size when parse
1 parent b2c82f5 commit 0238d73

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

Diff for: lib/connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class Connection extends EventEmitter {
553553

554554
recvFrame () {
555555
// %%% identifying invariants might help here?
556-
var frame = parseFrame(this.rest, this.frameMax);
556+
var frame = parseFrame(this.rest);
557557

558558
if (!frame) {
559559
var incoming = this.stream.read();

Diff for: lib/frame.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,11 @@ module.exports.makeBodyFrame = function(channel, payload) {
4747
var frameHeaderPattern = Bits.matcher('type:8', 'channel:16',
4848
'size:32', 'rest/binary');
4949

50-
function parseFrame(bin, max) {
50+
function parseFrame(bin) {
5151
var fh = frameHeaderPattern(bin);
5252
if (fh) {
5353
var size = fh.size, rest = fh.rest;
54-
if (size > max) {
55-
throw new Error('Frame size exceeds frame max');
56-
}
57-
else if (rest.length > size) {
54+
if (rest.length > size) {
5855
if (rest[size] !== FRAME_END)
5956
throw new Error('Invalid frame');
6057

Diff for: test/frame.js

-6
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ suite("Explicit parsing", function() {
6969
0,0,0,0, // garbage ID
7070
defs.constants.FRAME_END]);
7171

72-
testBogusFrame('> max frame',
73-
[defs.constants.FRAME_BODY,
74-
0,0, 0,0,0,6, // too big!
75-
65,66,67,68,69,70,
76-
defs.constants.FRAME_END]);
77-
7872
});
7973

8074
// Now for a bit more fun.

0 commit comments

Comments
 (0)