Skip to content
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

<regex>: Silence CodeQL false positive warning #5072

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

StephanTLavavej
Copy link
Member

Windows encountered internal OS-50456631 "[CodeQL:Warning]: SM02323: cpp/infiniteloop (in packages/[...]/regex)", reported to me by @DefaultRyan. According to the internal doc, this is:

[SM02323] Comparison of narrow type with wide type in loop condition
Comparisons between types of different widths in a loop condition can cause the loop to fail to terminate.

In this case, the warning is a false positive, and my suppression comment explains why.

Alternatively, we could widen the unsigned int to size_t, either with a static_cast or a named variable, but that'd be unusual enough to still merit a comment, so I chose the less invasive approach.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Nov 10, 2024
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner November 10, 2024 19:08
Copy link
Contributor

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is "Approve with Suggestions" unconditional approval.

stl/inc/regex Show resolved Hide resolved
@CaseyCarter CaseyCarter removed their assignment Nov 11, 2024
@StephanTLavavej StephanTLavavej self-assigned this Nov 14, 2024
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit e87ae37 into microsoft:main Nov 14, 2024
39 checks passed
@StephanTLavavej StephanTLavavej deleted the codeql-regex branch November 14, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants