You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2021/02/19 08:02:27 UTC

[thrift] branch master updated: THRIFT-5355 Do not rely on compiler and check boundaries Client: cpp Patch: Triton <19377203+EnigmaTriton@users.noreply.github.com>

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 62f1bd5  THRIFT-5355 Do not rely on compiler and check boundaries Client: cpp Patch: Triton <19...@users.noreply.github.com>
62f1bd5 is described below

commit 62f1bd556110e3e3795a1145c876a33d9dca2d37
Author: Triton <19...@users.noreply.github.com>
AuthorDate: Sat Jan 9 20:29:12 2021 +0100

    THRIFT-5355 Do not rely on compiler and check boundaries
    Client: cpp
    Patch: Triton <19...@users.noreply.github.com>
    
    This closes #2305
---
 lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
index 0dac524..7f1b1cc 100644
--- a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
+++ b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
@@ -184,7 +184,11 @@ int32_t TConcurrentClientSyncInfo::generateSeqId()
       throw apache::thrift::TApplicationException(
         TApplicationException::BAD_SEQUENCE_ID,
         "about to repeat a seqid");
-  int32_t newSeqId = nextseqid_++;
+  int32_t newSeqId = nextseqid_;
+  if (nextseqid_ == (std::numeric_limits<int32_t>::max)())
+    nextseqid_ = (std::numeric_limits<int32_t>::min)();
+  else
+    ++nextseqid_;
   seqidToMonitorMap_[newSeqId] = newMonitor_(seqidGuard);
   return newSeqId;
 }