Skip to content

Commit

Permalink
Fix a Few CodeQL Warnings (#4250)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks authored Apr 21, 2024
1 parent 50b16dc commit 3d70aa9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/core/recv_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ QuicRecvBufferRead(
Link);
BOOLEAN IsFirstChunk = TRUE;
uint32_t ChunkLength = RecvBuffer->ReadLength;
while (ChunkLength <= ReadOffset) {
while ((uint64_t)ChunkLength <= ReadOffset) {
CXPLAT_DBG_ASSERT(ChunkLength);
CXPLAT_DBG_ASSERT(Chunk->ExternalReference);
CXPLAT_DBG_ASSERT(Chunk->Link.Flink != &RecvBuffer->Chunks);
Expand Down
2 changes: 1 addition & 1 deletion src/core/stream_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ QuicStreamCopyFromSendRequests(
//
uint32_t CurIndex = 0; // Index of the current buffer.
uint64_t CurOffset = Offset - Req->StreamOffset; // Offset in the current buffer.
while (CurOffset >= Req->Buffers[CurIndex].Length) {
while (CurOffset >= (uint64_t)Req->Buffers[CurIndex].Length) {
CurOffset -= Req->Buffers[CurIndex++].Length;
}

Expand Down
4 changes: 2 additions & 2 deletions src/perf/lib/SecNetPerfMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ QuicMainStart(
if ((CpuStr = GetValue(argc, argv, "cpu")) != nullptr) {
SetConfig = true;
if (strtol(CpuStr, nullptr, 10) == -1) {
for (uint16_t i = 0; i < CxPlatProcCount() && Config->ProcessorCount < 256; ++i) {
Config->ProcessorList[Config->ProcessorCount++] = i;
for (uint32_t i = 0; i < CxPlatProcCount() && Config->ProcessorCount < 256; ++i) {
Config->ProcessorList[Config->ProcessorCount++] = (uint16_t)i;
}
} else {
do {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/unittest/CryptTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ struct CryptTest : public ::testing::TestWithParam<int32_t>
ASSERT_EQ(0, memcmp(HpMask, ExpectedHpMask.Data, ExpectedHpMask.Length));

PacketBuffer[0] ^= HpMask[0] & 0x1F;
for (uint8_t i = 1; i < ExpectedHeader.Length; ++i) {
for (uint16_t i = 1; i < ExpectedHeader.Length; ++i) {
PacketBuffer[i] ^= HpMask[i];
}
ASSERT_EQ(0, memcmp(PacketBuffer, ExpectedHeader.Data, ExpectedHeader.Length));
Expand Down

0 comments on commit 3d70aa9

Please sign in to comment.