Skip to content

Fix nullptr crash in RecConfigOverrideFromEnvironment with runroot#12917

Open
brbzull0 wants to merge 1 commit intoapache:masterfrom
brbzull0:fix_rec_runroot_override
Open

Fix nullptr crash in RecConfigOverrideFromEnvironment with runroot#12917
brbzull0 wants to merge 1 commit intoapache:masterfrom
brbzull0:fix_rec_runroot_override

Conversation

@brbzull0
Copy link
Contributor

When runroot is active and the PROXY_CONFIG_* environment variables for path records (bin_path, local_state_dir``, logfile_dir, plugin_dir) are not set, RecConfigOverrideFromEnvironment()returnednullptr. This violated its documented contract ("return either the overridden value, or the original value") and caused a std::logic_erro`r crash during records.yaml parsing:

  basic_string: construction from null is not valid

The nullptr was assigned to std::string in SetRecordFromYAMLNode(), which threw the exception. The bug was masked in autests because the framework always sets these env vars.

Fix: return the original config value instead of nullptr when RecConfigOverrideFromRunroot() matches. The record value is then resolved by Layout::relative() at runtime, producing the correct path.

Add a test that unsets the 4 path env vars to exercise the runroot code path, and validates record values via traffic_ctl config get.

When runroot is active and the PROXY_CONFIG_* environment variables for
path records (bin_path, local_state_dir, logfile_dir, plugin_dir) are
not set, RecConfigOverrideFromEnvironment() returned nullptr. This
violated its documented contract ("return either the overridden value,
or the original value") and caused a std::logic_error crash during
records.yaml parsing:

  basic_string: construction from null is not valid

The nullptr was assigned to std::string in SetRecordFromYAMLNode(),
which threw the exception. The bug was masked in autests because the
framework always sets these env vars.

Fix: return the original config value instead of nullptr when
RecConfigOverrideFromRunroot() matches. The record value is then
resolved by Layout::relative() at runtime, producing the correct path.

Add a test that unsets the 4 path env vars to exercise the runroot code
path, and validates record values via traffic_ctl config get.
@brbzull0 brbzull0 self-assigned this Feb 26, 2026
@brbzull0 brbzull0 added YAML Records Records related code. labels Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Records Records related code. YAML

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant