Skip to content

Commit

Permalink
Fix minor issues reported by CodeQL (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
merlimat committed Mar 27, 2024
1 parent 788227e commit 763b85c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/lz4/lz4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion perf/PerfProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 763b85c

Please sign in to comment.