Skip to content

Fix remaining uninitialized variable and field Coverity defects#13004

Merged
bryancall merged 2 commits intoapache:masterfrom
bryancall:coverity-uninit-batch2
Mar 23, 2026
Merged

Fix remaining uninitialized variable and field Coverity defects#13004
bryancall merged 2 commits intoapache:masterfrom
bryancall:coverity-uninit-batch2

Conversation

@bryancall
Copy link
Contributor

@bryancall bryancall commented Mar 19, 2026

Problem

Coverity reported several uninitialized variable and field defects in core HTTP/TLS code and experimental plugins, which could lead to undefined behavior and non-deterministic runtime state.

Changes

  • Initialize core proxy structs -- add in-class brace defaults for HttpVCTableEntry and HostStatRec fields so entries and host state begin in a deterministic state.
  • Initialize protocol parsing fields -- default ChunkedHandler::max_chunk_size and TLSSNISupport::ClientHello::_ext_len to known values.
  • Initialize plugin locals -- set explicit initial values for cache_fill parsing enum and txn_box feature return state.
  • Address portability in constructor init -- remove memset from HttpVCTable construction and rely on proper initialization, avoiding non-portable treatment of pointer-to-member-function types.

Testing

  • CI passed on GitHub checks
  • Verify Coverity marks CIDs 1021690, 1508845, 1533658, 1534712, 1544456, and 1645800 as fixed on next analysis run

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.
Copy link
Contributor

Copilot AI left a 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 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, and TLSSNISupport::ClientHello::_ext_len.
  • Initialize previously uninitialized locals in experimental plugins (txn_box Feature return value, cache_fill enum op).

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.
@bryancall bryancall requested a review from zwoop March 20, 2026 14:26
Copy link
Contributor

@bneradt bneradt left a comment

Choose a reason for hiding this comment

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

Pretty sraightforward.

@bryancall bryancall merged commit 9ca028f into apache:master Mar 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants