Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions lib/nodejs/lib/thrift/binary_protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,14 @@ TBinaryProtocol.prototype.getTransport = function () {
return this.trans;
};

TBinaryProtocol.prototype.skip = function (type) {
TBinaryProtocol.prototype.skip = function (type, depth) {
depth = (depth || 0) + 1;
if (depth > 64) {
throw new Thrift.TProtocolException(
Thrift.TProtocolExceptionType.DEPTH_LIMIT,
"Maximum skip depth exceeded"
);
}
switch (type) {
case Type.BOOL:
this.readBool();
Expand Down Expand Up @@ -350,30 +357,30 @@ TBinaryProtocol.prototype.skip = function (type) {
if (r.ftype === Type.STOP) {
break;
}
this.skip(r.ftype);
this.skip(r.ftype, depth);
this.readFieldEnd();
}
this.readStructEnd();
break;
case Type.MAP:
var mapBegin = this.readMapBegin();
for (var i = 0; i < mapBegin.size; ++i) {
this.skip(mapBegin.ktype);
this.skip(mapBegin.vtype);
this.skip(mapBegin.ktype, depth);
this.skip(mapBegin.vtype, depth);
}
this.readMapEnd();
break;
case Type.SET:
var setBegin = this.readSetBegin();
for (var i2 = 0; i2 < setBegin.size; ++i2) {
this.skip(setBegin.etype);
this.skip(setBegin.etype, depth);
}
this.readSetEnd();
break;
case Type.LIST:
var listBegin = this.readListBegin();
for (var i3 = 0; i3 < listBegin.size; ++i3) {
this.skip(listBegin.etype);
this.skip(listBegin.etype, depth);
}
this.readListEnd();
break;
Expand Down
19 changes: 13 additions & 6 deletions lib/nodejs/lib/thrift/compact_protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,14 @@ TCompactProtocol.prototype.zigzagToI64 = function (n) {
return new Int64(hi, lo);
};

TCompactProtocol.prototype.skip = function (type) {
TCompactProtocol.prototype.skip = function (type, depth) {
depth = (depth || 0) + 1;
if (depth > 64) {
throw new Thrift.TProtocolException(
Thrift.TProtocolExceptionType.DEPTH_LIMIT,
"Maximum skip depth exceeded"
);
}
switch (type) {
case Type.BOOL:
this.readBool();
Expand Down Expand Up @@ -934,30 +941,30 @@ TCompactProtocol.prototype.skip = function (type) {
if (r.ftype === Type.STOP) {
break;
}
this.skip(r.ftype);
this.skip(r.ftype, depth);
this.readFieldEnd();
}
this.readStructEnd();
break;
case Type.MAP:
var mapBegin = this.readMapBegin();
for (var i = 0; i < mapBegin.size; ++i) {
this.skip(mapBegin.ktype);
this.skip(mapBegin.vtype);
this.skip(mapBegin.ktype, depth);
this.skip(mapBegin.vtype, depth);
}
this.readMapEnd();
break;
case Type.SET:
var setBegin = this.readSetBegin();
for (var i2 = 0; i2 < setBegin.size; ++i2) {
this.skip(setBegin.etype);
this.skip(setBegin.etype, depth);
}
this.readSetEnd();
break;
case Type.LIST:
var listBegin = this.readListBegin();
for (var i3 = 0; i3 < listBegin.size; ++i3) {
this.skip(listBegin.etype);
this.skip(listBegin.etype, depth);
}
this.readListEnd();
break;
Expand Down
19 changes: 13 additions & 6 deletions lib/nodejs/lib/thrift/json_protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,14 @@ TJSONProtocol.prototype.getTransport = function () {
/**
* Method to arbitrarily skip over data
*/
TJSONProtocol.prototype.skip = function (type) {
TJSONProtocol.prototype.skip = function (type, depth) {
depth = (depth || 0) + 1;
if (depth > 64) {
throw new Thrift.TProtocolException(
Thrift.TProtocolExceptionType.DEPTH_LIMIT,
"Maximum skip depth exceeded"
);
}
switch (type) {
case Type.BOOL:
this.readBool();
Expand Down Expand Up @@ -814,30 +821,30 @@ TJSONProtocol.prototype.skip = function (type) {
if (r.ftype === Type.STOP) {
break;
}
this.skip(r.ftype);
this.skip(r.ftype, depth);
this.readFieldEnd();
}
this.readStructEnd();
break;
case Type.MAP:
var mapBegin = this.readMapBegin();
for (var i = 0; i < mapBegin.size; ++i) {
this.skip(mapBegin.ktype);
this.skip(mapBegin.vtype);
this.skip(mapBegin.ktype, depth);
this.skip(mapBegin.vtype, depth);
}
this.readMapEnd();
break;
case Type.SET:
var setBegin = this.readSetBegin();
for (var i2 = 0; i2 < setBegin.size; ++i2) {
this.skip(setBegin.etype);
this.skip(setBegin.etype, depth);
}
this.readSetEnd();
break;
case Type.LIST:
var listBegin = this.readListBegin();
for (var i3 = 0; i3 < listBegin.size; ++i3) {
this.skip(listBegin.etype);
this.skip(listBegin.etype, depth);
}
this.readListEnd();
break;
Expand Down
Loading