Skip to content

blog: Stop mutating caller-owned attr slices - #8847

Merged
aarongable merged 1 commit into
reland-slogfrom
slog-audit/08-blog-attr-slice-mutation
Jul 7, 2026
Merged

blog: Stop mutating caller-owned attr slices#8847
aarongable merged 1 commit into
reland-slogfrom
slog-audit/08-blog-attr-slice-mutation

Conversation

@beautifulentropy

@beautifulentropy beautifulentropy commented Jul 6, 2026

Copy link
Copy Markdown
Member

Error, AuditError, and AuditInfo appended internal attrs (error, audit) directly to the caller's variadic slice. When a caller passes a slice with spare capacity, that append writes into the caller's backing array, leaking a stray attr into any later use of the slice. Clip the slice first so the append always allocates. (ContextWith was given the equivalent fix during #8606 review, but these methods were missed.)

This PR was generated as part of an audit of #8606 using Claude Fable 5.

Error, AuditError, and AuditInfo appended internal attrs (error, audit)
directly to the caller's variadic slice. When a caller passes a slice
with spare capacity, that append writes into the caller's backing
array, leaking a stray attr into any later use of the slice. Clip the
slice first so the append always allocates. (ContextWith was given the
equivalent fix during #8606 review, but these methods were missed.)
@beautifulentropy
beautifulentropy requested a review from a team as a code owner July 6, 2026 19:03
@beautifulentropy
beautifulentropy requested a review from jsha July 6, 2026 19:03
@beautifulentropy beautifulentropy changed the title blog: stop mutating caller-owned attr slices blog: Stop mutating caller-owned attr slices Jul 6, 2026
@aarongable
aarongable changed the base branch from main to reland-slog July 6, 2026 21:20
@aarongable
aarongable merged commit fea684f into reland-slog Jul 7, 2026
18 checks passed
@aarongable
aarongable deleted the slog-audit/08-blog-attr-slice-mutation branch July 7, 2026 16:18
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.

3 participants