[chromecast] Fix Potential Renderer UAF in cast_receiver [chromium/src : main]

0 views
Skip to first unread message

Simeon Anfinrud (Gerrit)

unread,
May 13, 2026, 5:54:41 PMMay 13
to Mirko Bonadei, Jerome Jiang, android-bu...@system.gserviceaccount.com, Sandeep Vijayasekar, Code Review Nudger, chromium...@chromium.org, Shawn Quereshi, Chromium LUCI CQ, chrome-intell...@chromium.org, penghuan...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, net-r...@chromium.org, grt+...@chromium.org, mar...@chromium.org, jz...@chromium.org, cblume...@chromium.org, fgal...@chromium.org
Attention needed from Sandeep Vijayasekar and Shawn Quereshi

Simeon Anfinrud added 2 comments

File components/cast_receiver/renderer/content_renderer_client_mixins_impl.cc
Line 85, Patchset 9 (Latest): base::AutoLock lock(url_rewrite_rules_providers_lock_);
Simeon Anfinrud . unresolved

AI reviewer gave this WARNING reported by autoreview issue finding: Calling `erase` while holding the lock will trigger the destruction of the `UrlRewriteRulesProvider` inside the lock. If the destructor performs any complex cleanup or triggers other callbacks that might try to acquire this lock, it could lead to a deadlock.

It is safer to extract the unique_ptr from the map and let it be destroyed after the lock is released.

Line 101, Patchset 9 (Latest): : rules_it->second->GetCachedRules();
Simeon Anfinrud . unresolved

AI reviewer gave this WARNING reported by autoreview issue finding: Is `UrlRewriteRulesProvider::GetCachedRules()` thread-safe?

Since this method is called here while holding `url_rewrite_rules_providers_lock_`, and likely from multiple threads (based on the commit message), the provider itself needs to ensure that reading the cached rules is safe if they can be updated simultaneously on the main thread.

Open in Gerrit

Related details

Attention is currently required from:
  • Sandeep Vijayasekar
  • Shawn Quereshi
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2c9cf3cc4ce290eb60e31b2af9924e0a6e7566bd
Gerrit-Change-Number: 7765493
Gerrit-PatchSet: 9
Gerrit-Owner: Simeon Anfinrud <san...@chromium.org>
Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
Gerrit-Reviewer: Shawn Quereshi <sha...@google.com>
Gerrit-Reviewer: Simeon Anfinrud <san...@chromium.org>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: Jerome Jiang <ji...@chromium.org>
Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
Gerrit-Attention: Shawn Quereshi <sha...@google.com>
Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
Gerrit-Comment-Date: Wed, 13 May 2026 21:54:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Simeon Anfinrud (Gerrit)

unread,
May 13, 2026, 6:00:03 PMMay 13
to Mirko Bonadei, Jerome Jiang, android-bu...@system.gserviceaccount.com, Sandeep Vijayasekar, Code Review Nudger, chromium...@chromium.org, Shawn Quereshi, Chromium LUCI CQ, chrome-intell...@chromium.org, penghuan...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, net-r...@chromium.org, grt+...@chromium.org, mar...@chromium.org, jz...@chromium.org, cblume...@chromium.org, fgal...@chromium.org
Attention needed from Sandeep Vijayasekar and Shawn Quereshi

Simeon Anfinrud added 2 comments

Message

Gemini says: Addressed AI Reviewer feedback.

2 comments

File components/cast_receiver/renderer/content_renderer_client_mixins_impl.cc
File-level comment, Patchset 10 (Latest):
Simeon Anfinrud . resolved

Gemini says: Done. I extracted the unique_ptr out of the map before erasing it, so that the destructor is safely called outside the scope of the lock.

File-level comment, Patchset 10 (Latest):
Simeon Anfinrud . resolved

Gemini says: `UrlRewriteRulesProvider::GetCachedRules()` is actually thread-safe; it internally uses a `base::AutoLock` on its own lock when reading the cached rules, so no race conditions occur when called from multiple threads.

Open in Gerrit

Related details

Attention is currently required from:
  • Sandeep Vijayasekar
  • Shawn Quereshi
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I2c9cf3cc4ce290eb60e31b2af9924e0a6e7566bd
    Gerrit-Change-Number: 7765493
    Gerrit-PatchSet: 10
    Gerrit-Owner: Simeon Anfinrud <san...@chromium.org>
    Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Reviewer: Shawn Quereshi <sha...@google.com>
    Gerrit-Reviewer: Simeon Anfinrud <san...@chromium.org>
    Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
    Gerrit-CC: Jerome Jiang <ji...@chromium.org>
    Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
    Gerrit-Attention: Shawn Quereshi <sha...@google.com>
    Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Comment-Date: Wed, 13 May 2026 21:59:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Shawn Quereshi (Gerrit)

    unread,
    May 14, 2026, 10:23:00 AMMay 14
    to Simeon Anfinrud, Mirko Bonadei, Jerome Jiang, android-bu...@system.gserviceaccount.com, Sandeep Vijayasekar, Code Review Nudger, chromium...@chromium.org, Chromium LUCI CQ, chrome-intell...@chromium.org, penghuan...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, net-r...@chromium.org, grt+...@chromium.org, mar...@chromium.org, jz...@chromium.org, cblume...@chromium.org, fgal...@chromium.org
    Attention needed from Sandeep Vijayasekar and Simeon Anfinrud

    Shawn Quereshi voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Sandeep Vijayasekar
    • Simeon Anfinrud
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I2c9cf3cc4ce290eb60e31b2af9924e0a6e7566bd
      Gerrit-Change-Number: 7765493
      Gerrit-PatchSet: 11
      Gerrit-Owner: Simeon Anfinrud <san...@chromium.org>
      Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Reviewer: Shawn Quereshi <sha...@google.com>
      Gerrit-Reviewer: Simeon Anfinrud <san...@chromium.org>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-CC: Jerome Jiang <ji...@chromium.org>
      Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
      Gerrit-Attention: Simeon Anfinrud <san...@chromium.org>
      Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Comment-Date: Thu, 14 May 2026 14:22:50 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Simeon Anfinrud (Gerrit)

      unread,
      May 14, 2026, 3:18:57 PMMay 14
      to Shawn Quereshi, Mirko Bonadei, Jerome Jiang, android-bu...@system.gserviceaccount.com, Sandeep Vijayasekar, Code Review Nudger, chromium...@chromium.org, Chromium LUCI CQ, chrome-intell...@chromium.org, penghuan...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, net-r...@chromium.org, grt+...@chromium.org, mar...@chromium.org, jz...@chromium.org, cblume...@chromium.org, fgal...@chromium.org
      Attention needed from Sandeep Vijayasekar

      Simeon Anfinrud voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Sandeep Vijayasekar
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I2c9cf3cc4ce290eb60e31b2af9924e0a6e7566bd
      Gerrit-Change-Number: 7765493
      Gerrit-PatchSet: 12
      Gerrit-Owner: Simeon Anfinrud <san...@chromium.org>
      Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Reviewer: Shawn Quereshi <sha...@google.com>
      Gerrit-Reviewer: Simeon Anfinrud <san...@chromium.org>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-CC: Jerome Jiang <ji...@chromium.org>
      Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
      Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Comment-Date: Thu, 14 May 2026 19:18:45 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Simeon Anfinrud (Gerrit)

      unread,
      May 14, 2026, 3:44:26 PMMay 14
      to Shawn Quereshi, Mirko Bonadei, Jerome Jiang, android-bu...@system.gserviceaccount.com, Sandeep Vijayasekar, Code Review Nudger, chromium...@chromium.org, Chromium LUCI CQ, chrome-intell...@chromium.org, penghuan...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, net-r...@chromium.org, grt+...@chromium.org, mar...@chromium.org, jz...@chromium.org, cblume...@chromium.org, fgal...@chromium.org
      Attention needed from Sandeep Vijayasekar

      Simeon Anfinrud added 6 comments

      Message

      Gemini says: Addressed AI Reviewer feedback.

      6 comments

      File components/cast_receiver/renderer/content_renderer_client_mixins_impl.h
      Simeon Anfinrud . resolved

      Gemini says: Done.

      Simeon Anfinrud . resolved

      Gemini says: Done.

      File components/cast_receiver/renderer/content_renderer_client_mixins_impl.cc
      Simeon Anfinrud . resolved

      Gemini says: Done. I extracted the unique_ptr out of the map before erasing it, so that the destructor is safely called outside the scope of the lock.

      Simeon Anfinrud . resolved

      Gemini says: `UrlRewriteRulesProvider::GetCachedRules()` is actually thread-safe; it internally uses a `base::AutoLock` on its own lock when reading the cached rules, so no race conditions occur when called from multiple threads.

      Simeon Anfinrud . resolved

      Gemini says: Done.

      File components/cast_receiver/renderer/wrapping_url_loader_throttle_provider.h
      Simeon Anfinrud . resolved

      Gemini says: Done.

      Gerrit-Comment-Date: Thu, 14 May 2026 19:44:15 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      May 14, 2026, 4:46:09 PMMay 14
      to Simeon Anfinrud, Shawn Quereshi, Mirko Bonadei, Jerome Jiang, android-bu...@system.gserviceaccount.com, Sandeep Vijayasekar, Code Review Nudger, chromium...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, net-r...@chromium.org, grt+...@chromium.org, mar...@chromium.org, jz...@chromium.org, cblume...@chromium.org, fgal...@chromium.org

      Chromium LUCI CQ submitted the change

      Unreviewed changes

      11 is the latest approved patch-set.
      No files were changed between the latest approved patch-set and the submitted one.

      Change information

      Commit message:
      [chromecast] Fix Potential Renderer UAF in cast_receiver

      Introduce a base::Lock in ContentRendererClientMixinsImpl to synchronize
      access to url_rewrite_rules_providers_. This prevents a UAF caused by
      unsynchronized access between the main thread and worker threads.
      Bug: 501925480
      Test: Compiled and passed unit tests.
      Change-Id: I2c9cf3cc4ce290eb60e31b2af9924e0a6e7566bd
      Commit-Queue: Simeon Anfinrud <san...@chromium.org>
      Reviewed-by: Shawn Quereshi <sha...@google.com>
      Cr-Commit-Position: refs/heads/main@{#1630754}
      Files:
      • M components/cast_receiver/renderer/content_renderer_client_mixins_impl.cc
      • M components/cast_receiver/renderer/content_renderer_client_mixins_impl.h
      • M components/cast_receiver/renderer/wrapping_url_loader_throttle_provider.cc
      • M components/cast_receiver/renderer/wrapping_url_loader_throttle_provider.h
      Change size: M
      Delta: 4 files changed, 46 insertions(+), 32 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Shawn Quereshi
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I2c9cf3cc4ce290eb60e31b2af9924e0a6e7566bd
      Gerrit-Change-Number: 7765493
      Gerrit-PatchSet: 13
      Gerrit-Owner: Simeon Anfinrud <san...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Reviewer: Shawn Quereshi <sha...@google.com>
      Gerrit-Reviewer: Simeon Anfinrud <san...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages