-
Notifications
You must be signed in to change notification settings - Fork 2.3k
chore(codeql): address pre-existing CodeQL alerts #5243 #5244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -257,7 +257,6 @@ void SQLChannel::run() | |
| { | ||
| try | ||
| { | ||
| sleepTime = 100; | ||
| if (_reconnect) | ||
| { | ||
| close(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ SplitterChannel::~SplitterChannel() | |
| { | ||
| try | ||
| { | ||
| close(); | ||
| SplitterChannel::close(); | ||
| } | ||
| catch (...) | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,6 +563,7 @@ std::string IPAddress::trimIPv6(const std::string& v6Addr) | |
| if ((dblColOcc > 1) || | ||
| (std::count(v6addr.begin(), v6addr.end(), ':') > 8) || | ||
| (v6addr.find(":::") != std::string::npos) || | ||
| // CodeQL [cpp/constant-comparison]: intentional IPv6 validation — checks for trailing single colon | ||
| ((len >= 2) && ((v6addr[len-1] == ':') && v6addr[len-2] != ':'))) | ||
| { | ||
| return v6addr; | ||
|
|
@@ -581,6 +582,7 @@ IPAddress IPAddress::parse(const std::string& addr) | |
| bool IPAddress::tryParse(const std::string& addr, IPAddress& result) | ||
| { | ||
| IPv4AddressImpl impl4(IPv4AddressImpl::parse(addr)); | ||
| // CodeQL [cpp/auth-bypass]: IP address parsing, not authentication | ||
| if (impl4 != IPv4AddressImpl() || trim(addr) == "0.0.0.0") | ||
| { | ||
| result.newIPv4(impl4.addr()); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -347,8 +347,8 @@ void MailMessage::read(std::istream& istr, PartHandler& handler) | |
| } | ||
| else | ||
| { | ||
| StringPartHandler handler(_content); | ||
| readPart(istr, *this, handler); | ||
| StringPartHandler stringHandler(_content); | ||
| readPart(istr, *this, stringHandler); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Comparison result is always the same
Copilot Autofix
AI about 1 month ago
In general, to fix this type of issue you want the comparison to express a condition that can be either true or false given the actual runtime range of the operands. If part of a compound condition is provably always true (for example, checking that an unsigned‑derived value is
>= 0), that part should be removed or the type/range assumptions revisited.For this specific case in
ICMPv4PacketImpl::errorDescription(Net/src/ICMPv4PacketImpl.cpp), the intent is to ensurecodeis within the valid range for indexing the corresponding error‑description arrays. Becausecodeis derived from an ICMP headercodefield, which is an 8‑bit non‑negative value, only the upper bound of the range check is meaningful. The best fix that preserves behaviour is to remove the redundant lower‑bound checks while keeping the upper‑bound checks. Concretely:DESTINATION_UNREACHABLE_TYPEcase, changeif (code >= static_cast<int>(NET_UNREACHABLE) && code < static_cast<int>(DESTINATION_UNREACHABLE_UNKNOWN))toif (code < static_cast<int>(DESTINATION_UNREACHABLE_UNKNOWN)).REDIRECT_MESSAGE_TYPEcase, similarly drop thecode >= static_cast<int>(REDIRECT_NETWORK)part.TIME_EXCEEDED_TYPEcase, drop thecode >= static_cast<int>(TIME_TO_LIVE)part.No new methods or imports are needed; we only simplify the
ifconditions in the shown function.