Skip to content

Commit e2e19b5

Browse files
committed
Fix for cpp/comparison-with-wider-type
1 parent 3a9776b commit e2e19b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/crow/http_server.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ namespace crow
182182
uint16_t min_queue_idx = 0;
183183

184184
// TODO improve load balancing
185-
for (uint16_t i = 1; i < task_queue_length_pool_.size() && task_queue_length_pool_[min_queue_idx] > 0; i++)
185+
// size_t is used here to avoid the security issue https://codeql.github.com/codeql-query-help/cpp/cpp-comparison-with-wider-type/
186+
// even though the max value of this can be only uint16_t as capacity is uint16_t.
187+
for (size_t i = 1; i < task_queue_length_pool_.size() && task_queue_length_pool_[min_queue_idx] > 0; i++)
186188
// No need to check other io_services if the current one has no tasks
187189
{
188190
if (task_queue_length_pool_[i] < task_queue_length_pool_[min_queue_idx])

0 commit comments

Comments
 (0)