fix(config): stop leak and avoid buffer reuse#3759
Merged
morrisonlevi merged 3 commits intomasterfrom Apr 1, 2026
Merged
Conversation
There was an order of operations issue in mshutdown.
…onfig_find_and_set_value When a DD_ env var is cached as a short persistent allocation and the corresponding OTEL fallback is invoked, the code (pre-fix) passes the aliased buf—still pointing at that tiny allocation—directly to the fallback. ddtrace_conf_otel_propagators then writes up to 30 bytes via memcpy, overflowing the allocation. The trigger: DD_TRACE_PROPAGATION_STYLE=, (a bare comma). The comma is non-empty so PHP's proc_open passes it to the child process normally. SET_LOWERCASE decode rejects all-separator input (zero set elements), leaving value.len == 0, which causes the fallback to fire with the aliased 2-byte buffer. Under ASAN this crashes the process during MINIT. The fix (commit 433ca60) allocates a fresh ZAI_ENV_MAX_BUFSIZ buffer for every fallback call so the aliased pointer is never used as the write destination. Note: DD_TRACE_PROPAGATION_STYLE= (empty string) cannot be used because PHP's proc_open silently drops env-array entries with empty-string values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
✨ Fix all issues with BitsAI or with Cursor
|
bwoebi
reviewed
Apr 1, 2026
bwoebi
approved these changes
Apr 1, 2026
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.
Description
The leak is rare, it's happening on mshutdown, so unless you are spamming graceful restarts, this doesn't affect much, but of course, we should fix it anyway. Introduced by me in 1.17.0.
The buffer changes should fix #3729. I was able to make a phpt using a failed decoder with Claude's help.
Reviewer checklist