cfriedt commented on a change in pull request #2007:
URL: https://github.com/apache/thrift/pull/2007#discussion_r443698582



##########
File path: lib/cpp/src/thrift/transport/TBufferTransports.h
##########
@@ -587,11 +587,9 @@ class TMemoryBuffer : public 
TVirtualTransport<TMemoryBuffer, TBufferBase> {
   void resetBuffer() {
     rBase_ = buffer_;
     rBound_ = buffer_;
-    wBase_ = buffer_;
-    // It isn't safe to write into a buffer we don't own.
-    if (!owner_) {
-      wBound_ = wBase_;
-      bufferSize_ = 0;
+    if (owner_) {
+      wBase_ = buffer_;
+      wBound_ = buffer_ + bufferSize_;

Review comment:
       Please let me know if you would like additional testing done to 
illustrate things a bit more.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to