This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 225646b  THRIFT-4862 C++ TBinaryProtocol crashes on port scan Client: 
cpp Patch: Michael Patrick
225646b is described below

commit 225646b554e6c37de31657e11d907bf35d50679d
Author: Jens Geyer <[email protected]>
AuthorDate: Tue Nov 19 21:43:45 2019 +0100

    THRIFT-4862 C++ TBinaryProtocol crashes on port scan
    Client: cpp
    Patch: Michael Patrick
    
    This closes #1939
---
 lib/cpp/src/thrift/server/TNonblockingServer.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp 
b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
index eea0427..26ffa68 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
@@ -492,7 +492,11 @@ void TNonblockingServer::TConnection::workSocket() {
 
   case SOCKET_RECV:
     // It is an error to be in this state if we already have all the data
-    assert(readBufferPos_ < readWant_);
+    if (!(readBufferPos_ < readWant_)) {
+      GlobalOutput.printf("TNonblockingServer: frame size too short");
+      close();
+      return;
+    }
 
     try {
       // Read from the socket

Reply via email to