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

xyz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 763b85c  Fix minor issues reported by CodeQL (#421)
763b85c is described below

commit 763b85c6c4b9bb648b9f7cf62f9ed09f04f3decb
Author: Matteo Merli <[email protected]>
AuthorDate: Wed Mar 27 02:47:42 2024 -0700

    Fix minor issues reported by CodeQL (#421)
---
 lib/lz4/lz4.cc       | 6 +++---
 perf/PerfProducer.cc | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/lz4/lz4.cc b/lib/lz4/lz4.cc
index d63b977..2f98fb3 100644
--- a/lib/lz4/lz4.cc
+++ b/lib/lz4/lz4.cc
@@ -1175,9 +1175,9 @@ FORCE_INLINE int LZ4_decompress_generic(
                 s = *ip++;
                 length += s;
             } while (likely((endOnInput) ? ip < iend - RUN_MASK : 1) && (s == 
255));
-            if ((safeDecode) && unlikely((size_t)(op + length) < (size_t)(op)))
+            if ((safeDecode) && unlikely(length >= (size_t)(oend - op)))
                 goto _output_error; /* overflow detection */
-            if ((safeDecode) && unlikely((size_t)(ip + length) < (size_t)(ip)))
+            if ((safeDecode) && unlikely(length >= (size_t)(iend - ip)))
                 goto _output_error; /* overflow detection */
         }
 
@@ -1220,7 +1220,7 @@ FORCE_INLINE int LZ4_decompress_generic(
                 s = *ip++;
                 length += s;
             } while (s == 255);
-            if ((safeDecode) && unlikely((size_t)(op + length) < (size_t)op))
+            if ((safeDecode) && unlikely(length >= (size_t)(oend - op)))
                 goto _output_error; /* overflow detection */
         }
         length += MINMATCH;
diff --git a/perf/PerfProducer.cc b/perf/PerfProducer.cc
index aeda8e8..cbfef68 100644
--- a/perf/PerfProducer.cc
+++ b/perf/PerfProducer.cc
@@ -160,7 +160,7 @@ void startPerfProducer(const Arguments& args, 
pulsar::ProducerConfiguration& pro
         limiter = std::make_shared<pulsar::RateLimiter>(args.rate);
     }
 
-    producerList.resize(args.numTopics * args.numProducers);
+    producerList.resize((size_t)args.numTopics * args.numProducers);
     for (int i = 0; i < args.numTopics; i++) {
         std::string topic = (args.numTopics == 1) ? args.topic : args.topic + 
"-" + std::to_string(i);
         LOG_INFO("Adding " << args.numProducers << " producers on topic " << 
topic);

Reply via email to