Fix remaining uninitialized variable and field Coverity defects#13004
Open
bryancall wants to merge 2 commits intoapache:masterfrom
Open
Fix remaining uninitialized variable and field Coverity defects#13004bryancall wants to merge 2 commits intoapache:masterfrom
bryancall wants to merge 2 commits intoapache:masterfrom
Conversation
Add in-class brace initialization for uninitialized members in HttpVCTableEntry, HostStatRec, ChunkedHandler, and TLSSNISupport ClientHello. Initialize local enum and Feature variables in cache_fill and txn_box plugins. CIDs: 1021690, 1508845, 1533658, 1534712, 1544456, 1645800.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a set of Coverity “uninitialized variable / field” defects by adding deterministic default initialization for several structs and locals across core proxy code and experimental plugins.
Changes:
- Add in-class member initialization for
HttpVCTableEntry,HostStatRec,ChunkedHandler::max_chunk_size, andTLSSNISupport::ClientHello::_ext_len. - Initialize previously uninitialized locals in experimental plugins (
txn_boxFeaturereturn value,cache_fillenumop).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| plugins/experimental/txn_box/plugin/src/Ex_Base.cc | Initialize Feature return value to NIL_FEATURE to avoid default/uninitialized state. |
| plugins/experimental/cache_fill/configs.cc | Initialize Content-Length comparison operator enum before parsing. |
| include/proxy/http/HttpVCTable.h | Add in-class initialization for all HttpVCTableEntry members. |
| include/proxy/http/HttpTunnel.h | Default-initialize ChunkedHandler::max_chunk_size. |
| include/proxy/HostStatus.h | Default-initialize HostStatRec fields to a known state. |
| include/iocore/net/TLSSNISupport.h | Default-initialize ClientHello::_ext_len to 0. |
HttpVCTableEntry members now have in-class default initialization, making the memset redundant. Using memset on pointer-to-member-function types (HttpSMHandler) is also technically non-portable. Use a proper initializer list for the sm member instead.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add in-class brace initialization for uninitialized members in
HttpVCTableEntry,HostStatRec,ChunkedHandler, andTLSSNISupportClientHello. Initialize local enum andFeaturevariables incache_fillandtxn_boxplugins.CIDs: 1021690, 1508845, 1533658, 1534712, 1544456, 1645800.
Changes
cache_fill/configs.ccOPenum inreadConfigtxn_box/Ex_Base.ccFeature zret{}→Feature zret{NIL_FEATURE}HttpTunnel.hmax_chunk_size→{DEFAULT_MAX_CHUNK_SIZE}HttpVCTable.hHttpVCTableEntrymembersHostStatus.hHostStatRecmembersTLSSNISupport.h_ext_len→{0}inClientHelloTest plan