Skip to content

fix(utils): validate trace ID slice bounds before addition - #11951

Open
embrace897 wants to merge 1 commit into
deepflowio:mainfrom
embrace897:codex/main-trace-index-bounds
Open

embrace897 wants to merge 1 commit into
deepflowio:mainfrom
embrace897:codex/main-trace-index-bounds

Conversation

@embrace897

Copy link
Copy Markdown

GetTraceIdIndex accepts negative lengths and computes start+length before validating the slice bounds. Invalid lengths or overflowing offsets can therefore panic instead of returning an error. Reject nonpositive lengths and validate against the remaining string length before calculating the end offset.

Validation: an isolated Go harness uses the production function and hash implementation. The original code panics on a negative length; the patch passes four invalid-boundary cases and two valid cases. A package regression is included. Full utils package, server and eBPF validation were not run. Configuration-level reachability of invalid values was not established.

Prepared with AI assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant