mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
Thrift-1701:node.js TBufferedTransport buffer corruption
Patch: Marshall Roch fix buffer copy method calls git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1389517 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ffb031d74e
commit
41dfe6fd5e
@ -165,7 +165,7 @@ TBufferedTransport.prototype = {
|
||||
var bufSize = (unreadedSize * 2 > this.defaultReadBufferSize) ? unreadedSize * 2 : this.defaultReadBufferSize;
|
||||
var buf = new Buffer(bufSize);
|
||||
if (unreadedSize > 0) {
|
||||
this.inBuf.copy(buf, 0, this.readCursor, unreadedSize);
|
||||
this.inBuf.copy(buf, 0, this.readCursor, this.writeCursor);
|
||||
}
|
||||
this.readCursor = 0;
|
||||
this.writeCursor = unreadedSize;
|
||||
@ -195,7 +195,7 @@ TBufferedTransport.prototype = {
|
||||
throw new InputBufferUnderrunError();
|
||||
}
|
||||
var buf = new Buffer(this.writeCursor - this.readCursor);
|
||||
this.inBuf.copy(buf, 0, this.readCursor, this.writeCursor - this.readCursor);
|
||||
this.inBuf.copy(buf, 0, this.readCursor, this.writeCursor);
|
||||
this.readCursor = this.writeCursor;
|
||||
return buf;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user