-
Notifications
You must be signed in to change notification settings - Fork 851
Fix Coverity UNINIT issues #12842
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
base: master
Are you sure you want to change the base?
Fix Coverity UNINIT issues #12842
Conversation
Value-initialize DiagsConfigState to ensure the outputs array members are initialized to false before use. This fixes Coverity CID 1497238 (UNINIT).
Explicitly value-initialize ParsedValue to ensure the variant member is properly initialized. This fixes Coverity CID 1644237 (UNINIT).
Value-initialize TLSClientHelloSummary to ensure all members are properly initialized before use. This fixes Coverity CID 1644228 (UNINIT).
The condition for parsing Client-IP was inverted - it should load the IP range when the value is NOT a single '*' character. With the old logic, single-character non-'*' values would skip loading, leaving the IPRange uninitialized. This fixes Coverity CID 1533658 (UNINIT).
|
👋 Hi, I'm an automated AI code review bot. I ran some checks on this PR and found 3 points that might be worth attention (could be false positives, please use your judgment):
If you find these suggestions disruptive, you can reply "stop" , and I'll automatically skip this repository in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses four Coverity UNINIT (uninitialized variable) warnings and fixes an actual logic bug introduced in #10980. The changes include value-initializing three struct/class instances to ensure all members are properly initialized, and correcting an inverted condition in Client-IP parsing logic that was preventing the wildcard "*" value from being handled correctly.
Changes:
- Added value-initialization (
{}) to fix three uninitialized variable warnings in DiagsConfig, HttpConfig, and ja4_fingerprint test code - Fixed inverted condition logic bug in background_fetch and cache_fill plugins to correctly handle the
"*"wildcard for Client-IP matching
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/proxy/shared/DiagsConfig.cc | Value-initialize DiagsConfigState to fix CID 1497238 |
| src/proxy/http/HttpConfig.cc | Value-initialize ParsedValue to fix CID 1644237 |
| plugins/experimental/ja4_fingerprint/test_ja4.cc | Value-initialize TLSClientHelloSummary to fix CID 1644228 |
| plugins/experimental/cache_fill/configs.cc | Fix inverted condition (== to !=) for Client-IP wildcard handling (CID 1533658) |
| plugins/background_fetch/configs.cc | Fix inverted condition (== to !=) for Client-IP wildcard handling (CID 1533658) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Fix four Coverity UNINIT (uninitialized variable) issues:
DiagsConfigStateinreconfigure_diags()ParsedValueinParsedConfigCache::parse()TLSClientHelloSummaryintest_ja4.ccThe last fix (CID 1533658) is an actual logic bug introduced in #10980 - the condition
cfg_value.front() == '*'should becfg_value.front() != '*'to correctly skip loading when the value is exactly"*"(which signals "match any address" via an empty IPRange).