Skip to content

Commit 763b85c

Browse files
authored
Fix minor issues reported by CodeQL (#421)
1 parent 788227e commit 763b85c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/lz4/lz4.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1175,9 +1175,9 @@ FORCE_INLINE int LZ4_decompress_generic(
11751175
s = *ip++;
11761176
length += s;
11771177
} while (likely((endOnInput) ? ip < iend - RUN_MASK : 1) && (s == 255));
1178-
if ((safeDecode) && unlikely((size_t)(op + length) < (size_t)(op)))
1178+
if ((safeDecode) && unlikely(length >= (size_t)(oend - op)))
11791179
goto _output_error; /* overflow detection */
1180-
if ((safeDecode) && unlikely((size_t)(ip + length) < (size_t)(ip)))
1180+
if ((safeDecode) && unlikely(length >= (size_t)(iend - ip)))
11811181
goto _output_error; /* overflow detection */
11821182
}
11831183

@@ -1220,7 +1220,7 @@ FORCE_INLINE int LZ4_decompress_generic(
12201220
s = *ip++;
12211221
length += s;
12221222
} while (s == 255);
1223-
if ((safeDecode) && unlikely((size_t)(op + length) < (size_t)op))
1223+
if ((safeDecode) && unlikely(length >= (size_t)(oend - op)))
12241224
goto _output_error; /* overflow detection */
12251225
}
12261226
length += MINMATCH;

perf/PerfProducer.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void startPerfProducer(const Arguments& args, pulsar::ProducerConfiguration& pro
160160
limiter = std::make_shared<pulsar::RateLimiter>(args.rate);
161161
}
162162

163-
producerList.resize(args.numTopics * args.numProducers);
163+
producerList.resize((size_t)args.numTopics * args.numProducers);
164164
for (int i = 0; i < args.numTopics; i++) {
165165
std::string topic = (args.numTopics == 1) ? args.topic : args.topic + "-" + std::to_string(i);
166166
LOG_INFO("Adding " << args.numProducers << " producers on topic " << topic);

0 commit comments

Comments
 (0)