Fix unsafe buffer usage in literal_buffer.h [chromium/src : main]

0 views
Skip to first unread message

AI Code Reviewer (Gerrit)

unread,
Dec 9, 2025, 2:00:58 PM12/9/25
to Aditi Page, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org

AI Code Reviewer added 1 comment

File third_party/blink/renderer/core/html/parser/literal_buffer.h
Line 93, Patchset 1 (Latest): // To avoid Integer Overflow
AI Code Reviewer . unresolved

Blink Style Guide: Prefer blink:: types over STL and base types. Use 'blink::wtf_size_t' instead of 'size_t' for 'count' and the 'base::CheckedNumeric' template argument to match the rest of the file.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
Gerrit-Change-Number: 7240951
Gerrit-PatchSet: 1
Gerrit-Owner: Aditi Page <adit...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-Comment-Date: Tue, 09 Dec 2025 19:00:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Aditi Page (Gerrit)

unread,
Dec 9, 2025, 2:11:47 PM12/9/25
to Kouhei Ueno, Arthur Sonzogni, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Arthur Sonzogni and Kouhei Ueno

Aditi Page added 1 comment

File third_party/blink/renderer/core/html/parser/literal_buffer.h
Line 93, Patchset 1 (Latest): // To avoid Integer Overflow
AI Code Reviewer . unresolved

Blink Style Guide: Prefer blink:: types over STL and base types. Use 'blink::wtf_size_t' instead of 'size_t' for 'count' and the 'base::CheckedNumeric' template argument to match the rest of the file.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Aditi Page

Will create a new bug to address this since this is not fixing memory safety.

Open in Gerrit

Related details

Attention is currently required from:
  • Arthur Sonzogni
  • Kouhei Ueno
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
Gerrit-Change-Number: 7240951
Gerrit-PatchSet: 1
Gerrit-Owner: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Vincent Scheib <sch...@chromium.org>
Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Dec 2025 19:11:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Aditi Page (Gerrit)

unread,
Dec 9, 2025, 6:11:26 PM12/9/25
to Kouhei Ueno, Arthur Sonzogni, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Arthur Sonzogni and Kouhei Ueno

Aditi Page added 1 comment

File third_party/blink/renderer/core/html/parser/literal_buffer.h
Line 93, Patchset 1 (Latest): // To avoid Integer Overflow
AI Code Reviewer . resolved

Blink Style Guide: Prefer blink:: types over STL and base types. Use 'blink::wtf_size_t' instead of 'size_t' for 'count' and the 'base::CheckedNumeric' template argument to match the rest of the file.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Aditi Page

Will create a new bug to address this since this is not fixing memory safety.

Aditi Page

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Arthur Sonzogni
  • Kouhei Ueno
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
    Gerrit-Change-Number: 7240951
    Gerrit-PatchSet: 1
    Gerrit-Owner: Aditi Page <adit...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-CC: Vincent Scheib <sch...@chromium.org>
    Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Dec 2025 23:11:13 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Comment-In-Reply-To: Aditi Page <adit...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kouhei Ueno (Gerrit)

    unread,
    Dec 9, 2025, 7:37:05 PM12/9/25
    to Aditi Page, Mason Freed, Arthur Sonzogni, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Aditi Page, Arthur Sonzogni and Mason Freed

    Kouhei Ueno added 1 comment

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Kouhei Ueno . resolved

    Mason: I'd like to rely on you to make the call. I worry the performance implication of the change in the hot code path. Should we request measurements?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aditi Page
    • Arthur Sonzogni
    • Mason Freed
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
    Gerrit-Change-Number: 7240951
    Gerrit-PatchSet: 2
    Gerrit-Owner: Aditi Page <adit...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-CC: Vincent Scheib <sch...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Attention: Aditi Page <adit...@google.com>
    Gerrit-Comment-Date: Wed, 10 Dec 2025 00:36:31 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Dec 10, 2025, 6:47:35 PM12/10/25
    to Aditi Page, Kouhei Ueno, Arthur Sonzogni, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Aditi Page and Arthur Sonzogni

    Mason Freed added 1 comment

    Patchset-level comments
    Kouhei Ueno . unresolved

    Mason: I'd like to rely on you to make the call. I worry the performance implication of the change in the hot code path. Should we request measurements?

    Mason Freed

    Yeah, I'm definitely concerned about the same thing. This adds a ton of `CHECK` calls that likely slow down the parser significantly.

    I'll try to kick some off.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aditi Page
    • Arthur Sonzogni
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
      Gerrit-Change-Number: 7240951
      Gerrit-PatchSet: 2
      Gerrit-Owner: Aditi Page <adit...@google.com>
      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
      Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-CC: Vincent Scheib <sch...@chromium.org>
      Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Attention: Aditi Page <adit...@google.com>
      Gerrit-Comment-Date: Wed, 10 Dec 2025 23:47:26 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Kouhei Ueno <kou...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Mason Freed (Gerrit)

      unread,
      Dec 10, 2025, 6:49:28 PM12/10/25
      to Aditi Page, Kouhei Ueno, Arthur Sonzogni, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
      Attention needed from Aditi Page and Arthur Sonzogni

      Mason Freed added 1 comment

      Patchset-level comments
      Kouhei Ueno . unresolved

      Mason: I'd like to rely on you to make the call. I worry the performance implication of the change in the hot code path. Should we request measurements?

      Mason Freed

      Yeah, I'm definitely concerned about the same thing. This adds a ton of `CHECK` calls that likely slow down the parser significantly.

      I'll try to kick some off.

      Gerrit-Comment-Date: Wed, 10 Dec 2025 23:49:16 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
      Comment-In-Reply-To: Kouhei Ueno <kou...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      chromeperf@appspot.gserviceaccount.com (Gerrit)

      unread,
      Dec 10, 2025, 7:08:22 PM12/10/25
      to Aditi Page, Mason Freed, Kouhei Ueno, Arthur Sonzogni, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
      Attention needed from Aditi Page and Arthur Sonzogni

      Message from chrom...@appspot.gserviceaccount.com

      😿 Job mac-m4-mini-perf/speedometer3 failed.

      See results at: https://pinpoint-dot-chromeperf.appspot.com/job/12e6bfdf310000

      Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Attention: Aditi Page <adit...@google.com>
      Gerrit-Comment-Date: Thu, 11 Dec 2025 00:08:11 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Arthur Sonzogni (Gerrit)

      unread,
      Dec 11, 2025, 5:35:34 AM12/11/25
      to Aditi Page, chrom...@appspot.gserviceaccount.com, Mason Freed, Kouhei Ueno, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
      Attention needed from Aditi Page

      Arthur Sonzogni voted and added 1 comment

      Votes added by Arthur Sonzogni

      Code-Review-1

      1 comment

      Patchset-level comments
      Arthur Sonzogni . resolved

      Hi Aditi,

      Looking at the code, it doesn't compile for multiple reasons, including `-WUnsafe-buffer-usage`. In the future, could you please:

      • Compile the code locally.
      • Press the Commit-queue: +1 button and wait for the commit queue results before requesting a code review.

      About this patch, I don't think it would be trivial to use AI to fix the UNSAFE_TODO here. Mostly likely, they will be replaced by `UNSAFE_BUFFERS` and a comment explaining why this is safe.

      BTW, this isn't the original [AI patch](https://chromium-review.googlesource.com/c/chromium/src/+/7090591) that was proposed for the rotation.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Aditi Page
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is blockingCode-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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
        Gerrit-Change-Number: 7240951
        Gerrit-PatchSet: 2
        Gerrit-Owner: Aditi Page <adit...@google.com>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
        Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
        Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
        Gerrit-CC: Vincent Scheib <sch...@chromium.org>
        Gerrit-Attention: Aditi Page <adit...@google.com>
        Gerrit-Comment-Date: Thu, 11 Dec 2025 10:35:18 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        blocking_requirement
        open
        diffy

        Aditi Page (Gerrit)

        unread,
        Dec 12, 2025, 6:25:49 AM12/12/25
        to Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Mason Freed, Kouhei Ueno, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
        Attention needed from Kouhei Ueno and Mason Freed

        Aditi Page added 1 comment

        Patchset-level comments
        File-level comment, Patchset 2:
        Kouhei Ueno . resolved

        Mason: I'd like to rely on you to make the call. I worry the performance implication of the change in the hot code path. Should we request measurements?

        Mason Freed

        Yeah, I'm definitely concerned about the same thing. This adds a ton of `CHECK` calls that likely slow down the parser significantly.

        I'll try to kick some off.

        Mason Freed

        https://pinpoint-dot-chromeperf.appspot.com/job/12e6bfdf310000

        Aditi Page

        Acknowledged

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Kouhei Ueno
        • Mason Freed
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement is blockingCode-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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
          Gerrit-Change-Number: 7240951
          Gerrit-PatchSet: 5
          Gerrit-Owner: Aditi Page <adit...@google.com>
          Gerrit-Reviewer: Aditi Page <adit...@google.com>
          Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
          Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
          Gerrit-Comment-Date: Fri, 12 Dec 2025 11:25:38 +0000
          satisfied_requirement
          unsatisfied_requirement
          blocking_requirement
          open
          diffy

          Mason Freed (Gerrit)

          unread,
          Dec 18, 2025, 2:28:19 PM12/18/25
          to Aditi Page, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Kouhei Ueno, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
          Attention needed from Aditi Page and Kouhei Ueno

          Mason Freed voted and added 2 comments

          Votes added by Mason Freed

          Code-Review+1

          2 comments

          Patchset-level comments
          File-level comment, Patchset 5 (Latest):
          Mason Freed . resolved

          This looks good to me! Thanks for the detailed (and correct-looking) new SAFETY comments.

          It's a bit unfortunate that Arthur has marked this `-1` and then gone OOO. I'm afraid that'll make it unable to land without him removing his -1. But you have my LGTM for whenever that happens.

          File third_party/blink/renderer/core/html/parser/literal_buffer.h
          Line 102, Patchset 5 (Latest): this->Grow(new_size);
          Mason Freed . unresolved

          nit: you don't need `this->`.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Aditi Page
          • Kouhei Ueno
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is blockingCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
          Gerrit-Change-Number: 7240951
          Gerrit-PatchSet: 5
          Gerrit-Owner: Aditi Page <adit...@google.com>
          Gerrit-Reviewer: Aditi Page <adit...@google.com>
          Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
          Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
          Gerrit-CC: Vincent Scheib <sch...@chromium.org>
          Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
          Gerrit-Attention: Aditi Page <adit...@google.com>
          Gerrit-Comment-Date: Thu, 18 Dec 2025 19:28:05 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          blocking_requirement
          unsatisfied_requirement
          open
          diffy

          Aditi Page (Gerrit)

          unread,
          Dec 18, 2025, 3:47:48 PM12/18/25
          to Nate Chapin, Mason Freed, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Kouhei Ueno, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
          Attention needed from Kouhei Ueno and Nate Chapin

          Aditi Page added 1 comment

          File third_party/blink/renderer/core/html/parser/literal_buffer.h
          Line 102, Patchset 5 (Latest): this->Grow(new_size);
          Mason Freed . resolved

          nit: you don't need `this->`.

          Aditi Page

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Kouhei Ueno
          • Nate Chapin
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement is blockingCode-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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
            Gerrit-Change-Number: 7240951
            Gerrit-PatchSet: 5
            Gerrit-Owner: Aditi Page <adit...@google.com>
            Gerrit-Reviewer: Aditi Page <adit...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
            Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
            Gerrit-Reviewer: Nate Chapin <jap...@chromium.org>
            Gerrit-Attention: Nate Chapin <jap...@chromium.org>
            Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
            Gerrit-Comment-Date: Thu, 18 Dec 2025 20:47:30 +0000
            satisfied_requirement
            blocking_requirement
            open
            diffy

            Kouhei Ueno (Gerrit)

            unread,
            Dec 18, 2025, 9:00:37 PM12/18/25
            to Aditi Page, Nate Chapin, Mason Freed, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
            Attention needed from Aditi Page and Nate Chapin

            Kouhei Ueno voted and added 1 comment

            Votes added by Kouhei Ueno

            Code-Review+1

            1 comment

            Patchset-level comments
            Kouhei Ueno . resolved

            LGTM to unblock. Do we have the pinpoint run?

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Aditi Page
            • Nate Chapin
            Gerrit-Attention: Aditi Page <adit...@google.com>
            Gerrit-Comment-Date: Fri, 19 Dec 2025 02:00:00 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            blocking_requirement
            open
            diffy

            Aditi Page (Gerrit)

            unread,
            Dec 19, 2025, 2:15:07 PM12/19/25
            to Kouhei Ueno, Nate Chapin, Mason Freed, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
            Attention needed from Nate Chapin

            Aditi Page added 1 comment

            Patchset-level comments
            Mason Freed . resolved

            This looks good to me! Thanks for the detailed (and correct-looking) new SAFETY comments.

            It's a bit unfortunate that Arthur has marked this `-1` and then gone OOO. I'm afraid that'll make it unable to land without him removing his -1. But you have my LGTM for whenever that happens.

            Aditi Page

            Thank you for the review Mason and giving me more context on the performance aspect of this code change.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Nate Chapin
            Gerrit-Comment-Date: Fri, 19 Dec 2025 19:14:55 +0000
            satisfied_requirement
            blocking_requirement
            open
            diffy

            Aditi Page (Gerrit)

            unread,
            Dec 19, 2025, 6:11:23 PM12/19/25
            to Kouhei Ueno, Nate Chapin, Mason Freed, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
            Attention needed from Nate Chapin

            Aditi Page added 1 comment

            Patchset-level comments
            Kouhei Ueno . resolved

            LGTM to unblock. Do we have the pinpoint run?

            Aditi Page

            I'll trigger it. Thanks!

            Gerrit-Comment-Date: Fri, 19 Dec 2025 23:11:10 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Kouhei Ueno <kou...@chromium.org>
            satisfied_requirement
            blocking_requirement
            open
            diffy

            Arthur Sonzogni (Gerrit)

            unread,
            Jan 8, 2026, 6:08:29 AM (7 days ago) Jan 8
            to Aditi Page, Kouhei Ueno, Nate Chapin, Mason Freed, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
            Attention needed from Aditi Page and Nate Chapin

            Arthur Sonzogni added 3 comments

            Commit Message
            Line 7, Patchset 5 (Latest):Fix unsafe buffer usage in literal_buffer.h

            Replaced raw pointer arithmetic in LiteralBufferBase with safer C++
            constructs to prevent buffer overflows and other memory errors. This
            includes using base::CheckedContiguousIterator for safe iteration,
            adding bounds checks to pointer operations, and using
            base::CheckedNumeric to prevent integer overflows.

            Initial patchet generated by headless gemini-cli using:
            //agents/prompts/projects/spanification/run.py
            Arthur Sonzogni . unresolved

            The patch description needs to be updated to match to patch content.

            File third_party/blink/renderer/core/html/parser/literal_buffer.h
            Line 96, Patchset 5 (Latest): void AppendLiteralImpl(const LiteralBufferBase<OtherT, kOtherSize>& val) {
            static_assert(sizeof(T) >= sizeof(OtherT),
            "T is not big enough to contain OtherT");
            blink::wtf_size_t count = val.size();
            blink::wtf_size_t new_size = size() + count;
            if (capacity() < new_size) {
            this->Grow(new_size);
            }
            // SAFETY: The `Grow()` call above ensures that there is enough capacity to
            // append `count` characters.
            UNSAFE_BUFFERS(std::copy_n(val.data(), count, end_));
            UNSAFE_BUFFERS(end_ += count);
            }
            Arthur Sonzogni . unresolved

            A potential new integer overflow vulnerability here:

            Switching from `size_t` to `wtf_size_t` typically reduced the size from 64bit to 32bit. Now `size() + count` could typically overflow.

            This was `operator+(uint32_t, uint64_t)->uint64_t` and now it is `operator+(uint32_t, uint32_t)->uint32_t`.

            Then:
            ```
            // SAFETY: The `Grow()` call above ensures that there is enough capacity to
            // append `count` characters.
            UNSAFE_BUFFERS(std::copy_n(val.data(), count, end_));
            ```
            become incorrect, because we might not have called "grow".

            ----

            @mas...@chromium.org might know additional reasons why this couldn't fail?

            If not we can:

            • Use `base::CheckedNumeric::ValueOrDie()`, if performance allows it.
            • Abandon and keep UNSAFE_TODO() here. We keep the problem open for future folks.
            Line 102, Patchset 5 (Latest): this->Grow(new_size);
            Mason Freed . unresolved

            nit: you don't need `this->`.

            Aditi Page

            Done

            Arthur Sonzogni

            (Reopened, because this is not done)

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Aditi Page
            • Nate Chapin
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement satisfiedCode-Owners
              • requirement is blockingCode-Review
              • requirement is not satisfiedNo-Unresolved-Comments
              • 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
              Gerrit-Change-Number: 7240951
              Gerrit-PatchSet: 5
              Gerrit-Owner: Aditi Page <adit...@google.com>
              Gerrit-Reviewer: Aditi Page <adit...@google.com>
              Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
              Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
              Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
              Gerrit-Reviewer: Nate Chapin <jap...@chromium.org>
              Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
              Gerrit-CC: Arthur Sonzogni <arthurs...@google.com>
              Gerrit-Attention: Aditi Page <adit...@google.com>
              Gerrit-Comment-Date: Thu, 08 Jan 2026 11:08:10 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
              Comment-In-Reply-To: Aditi Page <adit...@google.com>
              satisfied_requirement
              blocking_requirement
              unsatisfied_requirement
              open
              diffy

              Arthur Sonzogni (Gerrit)

              unread,
              Jan 8, 2026, 6:08:34 AM (7 days ago) Jan 8
              to Aditi Page, Arthur Sonzogni, Kouhei Ueno, Nate Chapin, Mason Freed, Chromium LUCI CQ, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
              Attention needed from Aditi Page and Nate Chapin

              Arthur Sonzogni voted Code-Review+0

              Code-Review+0
              Open in Gerrit

              Related details

              Attention is currently required from:
              • Aditi Page
              • Nate Chapin
              Submit Requirements:
                • requirement satisfiedCode-Coverage
                • requirement satisfiedCode-Owners
                • requirement satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
                Gerrit-Change-Number: 7240951
                Gerrit-PatchSet: 5
                Gerrit-Owner: Aditi Page <adit...@google.com>
                Gerrit-Reviewer: Aditi Page <adit...@google.com>
                Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
                Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
                Gerrit-Reviewer: Nate Chapin <jap...@chromium.org>
                Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
                Gerrit-CC: Arthur Sonzogni <arthurs...@google.com>
                Gerrit-CC: Vincent Scheib <sch...@chromium.org>
                Gerrit-Attention: Nate Chapin <jap...@chromium.org>
                Gerrit-Attention: Aditi Page <adit...@google.com>
                Gerrit-Comment-Date: Thu, 08 Jan 2026 11:08:16 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy

                chromeperf@appspot.gserviceaccount.com (Gerrit)

                unread,
                4:58 PM (6 hours ago) 4:58 PM
                to Aditi Page, Code Review Nudger, Arthur Sonzogni, Kouhei Ueno, Nate Chapin, Mason Freed, Chromium LUCI CQ, Arthur Sonzogni, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
                Attention needed from Aditi Page and Nate Chapin

                Message from chrom...@appspot.gserviceaccount.com

                😿 Job mac-m4-mini-perf/speedometer3 failed.

                See results at: https://pinpoint-dot-chromeperf.appspot.com/job/138e8638710000

                Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
                Gerrit-CC: Vincent Scheib <sch...@chromium.org>
                Gerrit-Attention: Nate Chapin <jap...@chromium.org>
                Gerrit-Attention: Aditi Page <adit...@google.com>
                Gerrit-Comment-Date: Wed, 14 Jan 2026 21:58:27 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: No
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy

                Mason Freed (Gerrit)

                unread,
                6:46 PM (4 hours ago) 6:46 PM
                to Aditi Page, Code Review Nudger, Arthur Sonzogni, Kouhei Ueno, Nate Chapin, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
                Attention needed from Aditi Page, Arthur Sonzogni, Kouhei Ueno and Nate Chapin

                Mason Freed voted and added 3 comments

                Votes added by Mason Freed

                Code-Review+1

                3 comments

                Patchset-level comments
                File-level comment, Patchset 7 (Latest):
                Mason Freed . resolved

                Would be good to run another pinpoint, but this LGTM. I'll mark it.

                File third_party/blink/renderer/core/html/parser/literal_buffer.h
                Line 96, Patchset 5: void AppendLiteralImpl(const LiteralBufferBase<OtherT, kOtherSize>& val) {

                static_assert(sizeof(T) >= sizeof(OtherT),
                "T is not big enough to contain OtherT");
                blink::wtf_size_t count = val.size();
                blink::wtf_size_t new_size = size() + count;
                if (capacity() < new_size) {
                this->Grow(new_size);
                }
                // SAFETY: The `Grow()` call above ensures that there is enough capacity to
                // append `count` characters.
                UNSAFE_BUFFERS(std::copy_n(val.data(), count, end_));
                UNSAFE_BUFFERS(end_ += count);
                }
                Arthur Sonzogni . unresolved

                A potential new integer overflow vulnerability here:

                Switching from `size_t` to `wtf_size_t` typically reduced the size from 64bit to 32bit. Now `size() + count` could typically overflow.

                This was `operator+(uint32_t, uint64_t)->uint64_t` and now it is `operator+(uint32_t, uint32_t)->uint32_t`.

                Then:
                ```
                // SAFETY: The `Grow()` call above ensures that there is enough capacity to
                // append `count` characters.
                UNSAFE_BUFFERS(std::copy_n(val.data(), count, end_));
                ```
                become incorrect, because we might not have called "grow".

                ----

                @mas...@chromium.org might know additional reasons why this couldn't fail?

                If not we can:

                • Use `base::CheckedNumeric::ValueOrDie()`, if performance allows it.
                • Abandon and keep UNSAFE_TODO() here. We keep the problem open for future folks.
                Mason Freed

                Looks like the first one was chosen, which (perf-allowing) looks ok to me.

                Line 102, Patchset 5: this->Grow(new_size);
                Mason Freed . resolved

                nit: you don't need `this->`.

                Aditi Page

                Done

                Arthur Sonzogni

                (Reopened, because this is not done)

                Mason Freed

                Looks done now.

                Open in Gerrit

                Related details

                Attention is currently required from:
                • Aditi Page
                • Arthur Sonzogni
                • Kouhei Ueno
                • Nate Chapin
                Submit Requirements:
                  • requirement satisfiedCode-Coverage
                  • requirement satisfiedCode-Owners
                  • requirement is not satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • 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: I3b1a8c2edcfb93e42dcfa3b030cb0a48b785f296
                  Gerrit-Change-Number: 7240951
                  Gerrit-PatchSet: 7
                  Gerrit-Owner: Aditi Page <adit...@google.com>
                  Gerrit-Reviewer: Aditi Page <adit...@google.com>
                  Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                  Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
                  Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
                  Gerrit-Reviewer: Nate Chapin <jap...@chromium.org>
                  Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
                  Gerrit-CC: Arthur Sonzogni <arthurs...@google.com>
                  Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
                  Gerrit-CC: Vincent Scheib <sch...@chromium.org>
                  Gerrit-Attention: Nate Chapin <jap...@chromium.org>
                  Gerrit-Attention: Arthur Sonzogni <arthurs...@google.com>
                  Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
                  Gerrit-Attention: Aditi Page <adit...@google.com>
                  Gerrit-Comment-Date: Wed, 14 Jan 2026 23:46:01 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: Yes
                  Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
                  Comment-In-Reply-To: Arthur Sonzogni <arthurs...@google.com>
                  Comment-In-Reply-To: Aditi Page <adit...@google.com>
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Aditi Page (Gerrit)

                  unread,
                  7:46 PM (3 hours ago) 7:46 PM
                  to Mason Freed, Code Review Nudger, Arthur Sonzogni, Kouhei Ueno, Nate Chapin, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
                  Attention needed from Arthur Sonzogni, Kouhei Ueno and Nate Chapin

                  Aditi Page added 3 comments

                  Commit Message
                  Line 7, Patchset 5:Fix unsafe buffer usage in literal_buffer.h


                  Replaced raw pointer arithmetic in LiteralBufferBase with safer C++
                  constructs to prevent buffer overflows and other memory errors. This
                  includes using base::CheckedContiguousIterator for safe iteration,
                  adding bounds checks to pointer operations, and using
                  base::CheckedNumeric to prevent integer overflows.

                  Initial patchet generated by headless gemini-cli using:
                  //agents/prompts/projects/spanification/run.py
                  Arthur Sonzogni . resolved

                  The patch description needs to be updated to match to patch content.

                  Aditi Page

                  Acknowledged

                  File third_party/blink/renderer/core/html/parser/literal_buffer.h
                  Line 96, Patchset 5: void AppendLiteralImpl(const LiteralBufferBase<OtherT, kOtherSize>& val) {
                  static_assert(sizeof(T) >= sizeof(OtherT),
                  "T is not big enough to contain OtherT");
                  blink::wtf_size_t count = val.size();
                  blink::wtf_size_t new_size = size() + count;
                  if (capacity() < new_size) {
                  this->Grow(new_size);
                  }
                  // SAFETY: The `Grow()` call above ensures that there is enough capacity to
                  // append `count` characters.
                  UNSAFE_BUFFERS(std::copy_n(val.data(), count, end_));
                  UNSAFE_BUFFERS(end_ += count);
                  }
                  Arthur Sonzogni . resolved

                  A potential new integer overflow vulnerability here:

                  Switching from `size_t` to `wtf_size_t` typically reduced the size from 64bit to 32bit. Now `size() + count` could typically overflow.

                  This was `operator+(uint32_t, uint64_t)->uint64_t` and now it is `operator+(uint32_t, uint32_t)->uint32_t`.

                  Then:
                  ```
                  // SAFETY: The `Grow()` call above ensures that there is enough capacity to
                  // append `count` characters.
                  UNSAFE_BUFFERS(std::copy_n(val.data(), count, end_));
                  ```
                  become incorrect, because we might not have called "grow".

                  ----

                  @mas...@chromium.org might know additional reasons why this couldn't fail?

                  If not we can:

                  • Use `base::CheckedNumeric::ValueOrDie()`, if performance allows it.
                  • Abandon and keep UNSAFE_TODO() here. We keep the problem open for future folks.
                  Aditi Page

                  Acknowledged

                  Line 102, Patchset 5: this->Grow(new_size);
                  Mason Freed . resolved

                  nit: you don't need `this->`.

                  Aditi Page

                  Done

                  Arthur Sonzogni

                  (Reopened, because this is not done)

                  Aditi Page

                  Done

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Arthur Sonzogni
                  • Kouhei Ueno
                  • Nate Chapin
                  Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    • requirement satisfiedCode-Owners
                    • requirement is not satisfiedCode-Review
                    • requirement satisfiedReview-Enforcement
                    Gerrit-Comment-Date: Thu, 15 Jan 2026 00:46:03 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: No
                    satisfied_requirement
                    unsatisfied_requirement
                    open
                    diffy

                    Aditi Page (Gerrit)

                    unread,
                    7:47 PM (3 hours ago) 7:47 PM
                    to Mason Freed, Code Review Nudger, Arthur Sonzogni, Kouhei Ueno, Nate Chapin, Chromium LUCI CQ, Arthur Sonzogni, chrom...@appspot.gserviceaccount.com, Vincent Scheib, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
                    Attention needed from Arthur Sonzogni, Kouhei Ueno and Nate Chapin

                    Aditi Page added 1 comment

                    Patchset-level comments
                    Mason Freed . resolved

                    Would be good to run another pinpoint, but this LGTM. I'll mark it.

                    Aditi Page

                    Yes, thanks for looking at this!

                    Open in Gerrit

                    Related details

                    Attention is currently required from:
                    • Arthur Sonzogni
                    • Kouhei Ueno
                    • Nate Chapin
                    Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    Gerrit-Comment-Date: Thu, 15 Jan 2026 00:46:46 +0000
                    satisfied_requirement
                    unsatisfied_requirement
                    open
                    diffy
                    Reply all
                    Reply to author
                    Forward
                    0 new messages