Skip to content

<regex>: Silence CodeQL false positive warning - #5072

Merged
Stephan T. Lavavej (StephanTLavavej) merged 1 commit into
microsoft:mainfrom
StephanTLavavej:codeql-regex
Nov 14, 2024
Merged

<regex>: Silence CodeQL false positive warning#5072
Stephan T. Lavavej (StephanTLavavej) merged 1 commit into
microsoft:mainfrom
StephanTLavavej:codeql-regex

Conversation

@StephanTLavavej

Copy link
Copy Markdown
Member

Windows encountered internal OS-50456631 "[CodeQL:Warning]: SM02323: cpp/infiniteloop (in packages/[...]/regex)", reported to me by Ryan Shepherd (@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.

@CaseyCarter Casey Carter (CaseyCarter) left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread stl/inc/regex
@StephanTLavavej

Copy link
Copy Markdown
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved regex meow is a substring of homeowner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants