Skip to content

tp: fix stack OOB write in ParseChromeEvents Chrome metadata key#5586

Merged
LalitMaganti merged 1 commit into
mainfrom
dev/lalitm/fix-chrome-metadata-oob
Apr 25, 2026
Merged

tp: fix stack OOB write in ParseChromeEvents Chrome metadata key#5586
LalitMaganti merged 1 commit into
mainfrom
dev/lalitm/fix-chrome-metadata-oob

Conversation

@LalitMaganti
Copy link
Copy Markdown
Member

@LalitMaganti LalitMaganti commented Apr 25, 2026

ParseChromeEvents built a "cr-[-]" key for each
ChromeMetadata entry into a fixed 2048-byte stack buffer via
FixedStringWriter, whose only bounds check is PERFETTO_DCHECK (a no-op
in release). Since metadata.name() can theoretically be arbitrary size,
an oversized name causes an out-of-bounds memcpy past
the buffer, corrupting adjacent stack state (e.g. the ArgsTracker
declared earlier in the function) before the stack canary is checked.

Build the key into a std::string instead. Not a hot path (a handful of
metadata entries per trace), so the heap allocation is negligible.

ParseChromeEvents built a "cr-[<index>-]<name>" key for each
ChromeMetadata entry into a fixed 2048-byte stack buffer via
FixedStringWriter, whose only bounds check is PERFETTO_DCHECK (a no-op
in release). Since metadata.name() is an attacker-controllable string
from the trace, an oversized name causes an out-of-bounds memcpy past
the buffer, corrupting adjacent stack state (e.g. the ArgsTracker
declared earlier in the function) before the stack canary is checked.

Build the key into a std::string instead. Not a hot path (a handful of
metadata entries per trace), so the heap allocation is negligible.
@LalitMaganti LalitMaganti requested a review from a team as a code owner April 25, 2026 14:16
@github-actions
Copy link
Copy Markdown

🎨 Perfetto UI Builds

@LalitMaganti LalitMaganti enabled auto-merge (squash) April 25, 2026 14:22
@LalitMaganti LalitMaganti merged commit 81f80f2 into main Apr 25, 2026
24 checks passed
@LalitMaganti LalitMaganti deleted the dev/lalitm/fix-chrome-metadata-oob branch April 25, 2026 14:38
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.

2 participants