Skip to content

[c25] Implement safe guard against potential std::string constructor with NULL pointer - #8188

Merged
oxve merged 3 commits into
youtube:25.lts.1+from
sideb0ard:amazonCrash
Jan 14, 2026
Merged

oxve merged 3 commits into
youtube:25.lts.1+from
sideb0ard:amazonCrash

Conversation

@sideb0ard

Copy link
Copy Markdown
Member

Amazon are trying to rollout C25, but running into a high number of crashes on Cobalt version 5.30.2

The stacktrace points to an error with string handling around SbPlayerCreate. The stacktrace points to DecoderStatusCB, but the PlayerErrorCB function is also in the trace and is a more likely culprit due to its handling of a const char* message.

The crash is likely happening when a std::string is implicitly created from the message argument, which is a const char*. This can happen in two places inside PlayerErrorCB:

  1. In the call to helper->TryToSetPlayerCreationErrorMessage(message).
  2. In the base::Bind call: message ? std::string(message) : ""

If message is a null pointer, the first case will crash. The second case is already handling the null case correctly.

This change implements a defensive check against that happening, by replacing a NULL pointer with an empty string.

Bug: 455621481

Change-Id: I8a436437a3b65245426f365d66e3cc801cafed13

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses a potential crash by safeguarding against the construction of a std::string from a NULL pointer. The change is correct and directly solves the issue described. My review includes one suggestion to make the std::string construction explicit, which would improve code clarity and consistency by avoiding reliance on implicit type conversions.

Comment thread cobalt/media/base/sbplayer_bridge.cc Resolved
Change-Id: I6fb0ddad91b9aecbd171118938435840660f4da5
@lamdbui
lamdbui enabled auto-merge (squash) January 12, 2026 21:48
@oxve
oxve disabled auto-merge January 14, 2026 20:23
@oxve
oxve merged commit 88fbd0b into youtube:25.lts.1+ Jan 14, 2026
812 of 851 checks passed
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.

5 participants