From: David Reiss Date: Fri, 9 May 2008 00:40:26 +0000 (+0000) Subject: Fix a small logic error in TBufferedTransport::borrowSlow. X-Git-Tag: 0.2.0~792 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=47714584327a9a8240f28e8ef4493534a1d047ba;p=common%2Fthrift.git Fix a small logic error in TBufferedTransport::borrowSlow. Was using an unsigned int for a value that could be negative. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665680 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/transport/TBufferTransports.cpp b/lib/cpp/src/transport/TBufferTransports.cpp index 9164a1f9..0deef1bf 100644 --- a/lib/cpp/src/transport/TBufferTransports.cpp +++ b/lib/cpp/src/transport/TBufferTransports.cpp @@ -101,7 +101,7 @@ const uint8_t* TBufferedTransport::borrowSlow(uint8_t* buf, uint32_t* len) { // The number of bytes of data we have already. uint32_t have = rBound_ - rBase_; // The number of additional bytes we need from the underlying transport. - uint32_t need = *len - have; + int32_t need = *len - have; // The space from the start of the buffer to the end of our data. uint32_t offset = rBound_ - rBuf_.get(); assert(need > 0);