THRIFT-5769: fix invalid size error on large messages
Client: nodejs
diff --git a/lib/nodejs/test/header.test.js b/lib/nodejs/test/header.test.js
index 99bb832..12f1557 100644
--- a/lib/nodejs/test/header.test.js
+++ b/lib/nodejs/test/header.test.js
@@ -100,6 +100,18 @@
assert.equals(otherHeaders.foo, undefined);
assert.equals(otherHeaders.otherfoo, "baz");
assert.end();
+ },
+ "Should handle large messages without crashing": function(assert) {
+ const callback = function() {};
+ const onData = TFramedTransport.receiver(callback);
+
+ const largeChunkSize = 2 * 100 * 1024 * 1024;
+ const largeChunk = Buffer.alloc(largeChunkSize, "A");
+ const sizeBuffer = new Buffer(4);
+ sizeBuffer.writeInt32BE(largeChunkSize + 4, 0);
+ onData(Buffer.concat([sizeBuffer, largeChunk]));
+
+ assert.end();
}
};
diff --git a/lib/nodejs/test/testAll.sh b/lib/nodejs/test/testAll.sh
index 37b6b43..144832e 100755
--- a/lib/nodejs/test/testAll.sh
+++ b/lib/nodejs/test/testAll.sh
@@ -118,6 +118,7 @@
# unit tests
node ${DIR}/binary.test.js || TESTOK=1
+node ${DIR}/header.test.js || TESTOK=1
node ${DIR}/int64.test.js || TESTOK=1
node ${DIR}/deep-constructor.test.js || TESTOK=1