THRIFT-4862 C++ TBinaryProtocol crashes on port scan
Client: cpp
Patch: Michael Patrick
This closes #1939
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 @@
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