[WebAudio] Handle OOM in AudioArray [chromium/src : main]

0 views
Skip to first unread message

Hongchan Choi (Gerrit)

unread,
Mar 2, 2026, 6:09:14 PM (3 days ago) Mar 2
to Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
Attention needed from Michael Wilson

Hongchan Choi added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Hongchan Choi . resolved

PTAL at t/b/r/m/webaudio/*

Because we cannot directly throw exceptions from the (Offline)AudioContext constructor, I’ve introduced an internal state flag. This allows us to defer and gracefully throw the exception at the end of the factory method (e.g., ::Create()).

In my view, this is the most efficient approach to handle allocation failures without requiring a large-scale refactor/redesign of all AudioContext and AudioNode constructors.

The main goal of this CL is the introduction of TryAllocate() within the memory infrastructure. The fixes to the upper layers are an additional benefit of this change, and further improvements can be done in follow-up work.

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Wilson
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: I2b53473ce808dc0f420493020763ba1be37fe31b
Gerrit-Change-Number: 7624386
Gerrit-PatchSet: 1
Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
Gerrit-Attention: Michael Wilson <mjwi...@chromium.org>
Gerrit-Comment-Date: Mon, 02 Mar 2026 23:09:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

AI Code Reviewer (Gerrit)

unread,
Mar 2, 2026, 6:13:24 PM (3 days ago) Mar 2
to Hongchan Choi, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
Attention needed from Michael Wilson

AI Code Reviewer added 1 comment

File third_party/blink/renderer/modules/webaudio/base_audio_context.h
Line 414, Patchset 1 (Latest): bool is_allocation_failed_ = false;
AI Code Reviewer . unresolved

nit: Blink Style Guide: Naming. Variable names should match the names of the getter/setter. Consider renaming 'is_allocation_failed_' to 'has_allocation_failed_' to match the getter 'HasAllocationFailed()'.

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 is currently required from:
  • Michael Wilson
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: I2b53473ce808dc0f420493020763ba1be37fe31b
    Gerrit-Change-Number: 7624386
    Gerrit-PatchSet: 1
    Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
    Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
    Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Michael Wilson <mjwi...@chromium.org>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 23:13:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Wilson (Gerrit)

    unread,
    Mar 2, 2026, 9:08:09 PM (3 days ago) Mar 2
    to Hongchan Choi, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
    Attention needed from Hongchan Choi

    Michael Wilson added 7 comments

    File third_party/blink/public/platform/web_audio_bus.h
    Line 51, Patchset 1 (Latest): void Initialize(unsigned number_of_channels,
    Michael Wilson . unresolved

    Is there any situation where we want to call `Initialize` instead of `TryInitialize`?

    File third_party/blink/renderer/modules/webaudio/audio_context.cc
    Line 511, Patchset 1 (Latest): DOMExceptionCode::kNotSupportedError,
    Michael Wilson . unresolved

    I think `UnknownError` is more appropriate here: https://webidl.spec.whatwg.org/#unknownerror

    "The operation failed for an unknown transient reason (e.g. out of memory)."

    File third_party/blink/renderer/modules/webaudio/audio_node_input.cc
    Line 48, Patchset 1 (Latest): internal_summing_bus_ = AudioBus::Create(1, 1);
    Michael Wilson . unresolved

    Technically this could also fail. We could possibly statically allocate a fallback bus instead, which would always be available, but if we do any sort of deletion on `internal_summing_bus_` that wouldn't work.

    Perhaps doing `TryCreate` with a `CHECK` afterward would be better though? Then at least we will crash early in extreme OOM situations.

    File third_party/blink/renderer/modules/webaudio/offline_audio_context.cc
    Line 129, Patchset 1 (Latest): DOMExceptionCode::kNotSupportedError,
    Michael Wilson . unresolved

    As above, UnknownError may be more appropriate here.

    File third_party/blink/renderer/modules/webaudio/offline_audio_destination_handler.cc
    Line 149, Patchset 1 (Latest): render_bus_ = AudioBus::Create(render_target->numberOfChannels(), 1);
    Michael Wilson . unresolved

    Similar comment here as in audio_node_input.cc

    File third_party/blink/renderer/platform/audio/audio_bus.cc
    Line 60, Patchset 1 (Latest): return nullptr;
    Michael Wilson . unresolved

    It seems like the normal AudioBus::Create can also fail. Would it be better to migrate all creation to `TryCreate` here too?

    File third_party/blink/renderer/platform/audio/audio_channel.h
    Line 64, Patchset 1 (Latest): void Allocate(uint32_t length) { CHECK(TryAllocate(length)); }
    Michael Wilson . unresolved

    Is this actually used anywhere? If not, let's remove it.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hongchan Choi
    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: I2b53473ce808dc0f420493020763ba1be37fe31b
    Gerrit-Change-Number: 7624386
    Gerrit-PatchSet: 1
    Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
    Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
    Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
    Gerrit-Comment-Date: Tue, 03 Mar 2026 02:08:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hongchan Choi (Gerrit)

    unread,
    Mar 3, 2026, 8:28:45 PM (2 days ago) Mar 3
    to AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
    Attention needed from Michael Wilson

    Hongchan Choi voted and added 9 comments

    Votes added by Hongchan Choi

    Commit-Queue+1

    9 comments

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Hongchan Choi . resolved

    Please note that this is a reland of crrev.com/c/7586396, plus small changes on the Blink WebAudio classes.

    PTAL nuskos@ - t/b/r/p/wtf/allocator/*
    PTAL haraken@ - everything else outside of t/b/r/p/audio/

    File third_party/blink/public/platform/web_audio_bus.h
    Line 51, Patchset 1: void Initialize(unsigned number_of_channels,
    Michael Wilson . resolved

    Is there any situation where we want to call `Initialize` instead of `TryInitialize`?

    Hongchan Choi

    Good catch. Removed.

    File third_party/blink/renderer/modules/webaudio/audio_context.cc
    Line 511, Patchset 1: DOMExceptionCode::kNotSupportedError,
    Michael Wilson . resolved

    I think `UnknownError` is more appropriate here: https://webidl.spec.whatwg.org/#unknownerror

    "The operation failed for an unknown transient reason (e.g. out of memory)."

    Hongchan Choi

    I'd prefer to avoid "unknown" here — we know the reason, so the error should reflect that. I’m leaning toward `NotSupportedError` for a few reasons:

    1. https://www.w3.org/TR/webaudio-1.1/#AudioBuffer-constructors

      - "If any of the values in options lie outside its nominal range, throw a NotSupportedError exception and abort the following steps."

    2. https://tc39.es/ecma262/#sec-createbytedatablock

      - "If it is impossible to create such a Data Block, throw a RangeError exception."

    3. Another justification of NotSupportedError:

      - When the implementation fails to allocate memory as "the requested size is not supported by the system".

    Let’s stick to the AudioBuffer pattern and go with NotSupportedError.

    File third_party/blink/renderer/modules/webaudio/audio_node_input.cc
    Line 48, Patchset 1: internal_summing_bus_ = AudioBus::Create(1, 1);
    Michael Wilson . resolved

    Technically this could also fail. We could possibly statically allocate a fallback bus instead, which would always be available, but if we do any sort of deletion on `internal_summing_bus_` that wouldn't work.

    Perhaps doing `TryCreate` with a `CHECK` afterward would be better though? Then at least we will crash early in extreme OOM situations.

    Hongchan Choi

    Done

    File third_party/blink/renderer/modules/webaudio/base_audio_context.h
    Line 414, Patchset 1: bool is_allocation_failed_ = false;
    AI Code Reviewer . resolved

    nit: Blink Style Guide: Naming. Variable names should match the names of the getter/setter. Consider renaming 'is_allocation_failed_' to 'has_allocation_failed_' to match the getter 'HasAllocationFailed()'.

    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)_

    Hongchan Choi

    Done

    File third_party/blink/renderer/modules/webaudio/offline_audio_context.cc
    Line 129, Patchset 1: DOMExceptionCode::kNotSupportedError,
    Michael Wilson . resolved

    As above, UnknownError may be more appropriate here.

    Hongchan Choi

    Acknowledged

    File third_party/blink/renderer/modules/webaudio/offline_audio_destination_handler.cc
    Line 149, Patchset 1: render_bus_ = AudioBus::Create(render_target->numberOfChannels(), 1);
    Michael Wilson . resolved

    Similar comment here as in audio_node_input.cc

    Hongchan Choi

    Done.

    File third_party/blink/renderer/platform/audio/audio_bus.cc
    Line 60, Patchset 1: return nullptr;
    Michael Wilson . resolved

    It seems like the normal AudioBus::Create can also fail. Would it be better to migrate all creation to `TryCreate` here too?

    Hongchan Choi

    Done.

    File third_party/blink/renderer/platform/audio/audio_channel.h
    Line 64, Patchset 1: void Allocate(uint32_t length) { CHECK(TryAllocate(length)); }
    Michael Wilson . resolved

    Is this actually used anywhere? If not, let's remove it.

    Hongchan Choi

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Wilson
    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: I2b53473ce808dc0f420493020763ba1be37fe31b
      Gerrit-Change-Number: 7624386
      Gerrit-PatchSet: 2
      Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
      Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
      Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-Attention: Michael Wilson <mjwi...@chromium.org>
      Gerrit-Comment-Date: Wed, 04 Mar 2026 01:28:30 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Michael Wilson <mjwi...@chromium.org>
      Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Michael Wilson (Gerrit)

      unread,
      Mar 4, 2026, 12:42:56 AM (yesterday) Mar 4
      to Hongchan Choi, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
      Attention needed from Hongchan Choi

      Michael Wilson voted and added 3 comments

      Votes added by Michael Wilson

      Code-Review+1

      3 comments

      Patchset-level comments
      Michael Wilson . resolved

      LGTM overall, please see comment about create methods in AudioBus.

      File third_party/blink/renderer/modules/webaudio/audio_context.cc
      Line 511, Patchset 1: DOMExceptionCode::kNotSupportedError,
      Michael Wilson . resolved

      I think `UnknownError` is more appropriate here: https://webidl.spec.whatwg.org/#unknownerror

      "The operation failed for an unknown transient reason (e.g. out of memory)."

      Hongchan Choi

      I'd prefer to avoid "unknown" here — we know the reason, so the error should reflect that. I’m leaning toward `NotSupportedError` for a few reasons:

      1. https://www.w3.org/TR/webaudio-1.1/#AudioBuffer-constructors

        - "If any of the values in options lie outside its nominal range, throw a NotSupportedError exception and abort the following steps."

      2. https://tc39.es/ecma262/#sec-createbytedatablock

        - "If it is impossible to create such a Data Block, throw a RangeError exception."

      3. Another justification of NotSupportedError:

        - When the implementation fails to allocate memory as "the requested size is not supported by the system".

      Let’s stick to the AudioBuffer pattern and go with NotSupportedError.

      Michael Wilson

      Acknowledged. If it turns out to be a problem we can work with the Audio Working Group to specify it and change the error type in the future.

      File third_party/blink/renderer/platform/audio/audio_bus.cc
      Line 60, Patchset 1: return nullptr;
      Michael Wilson . unresolved

      It seems like the normal AudioBus::Create can also fail. Would it be better to migrate all creation to `TryCreate` here too?

      Hongchan Choi

      Done.

      Michael Wilson

      Sorry, I wasn't clear with my comment.

      Since the normal `Create` method can actually return `nullptr`, it is effectively already a `TryCreate`. So, I think for clarity it would be better to remove the `Create` method and only use the `TryCreate` method for this class.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hongchan Choi
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not 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: I2b53473ce808dc0f420493020763ba1be37fe31b
        Gerrit-Change-Number: 7624386
        Gerrit-PatchSet: 2
        Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
        Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
        Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
        Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
        Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
        Gerrit-Comment-Date: Wed, 04 Mar 2026 05:42:46 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Michael Wilson <mjwi...@chromium.org>
        Comment-In-Reply-To: Hongchan Choi <hong...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Hongchan Choi (Gerrit)

        unread,
        Mar 4, 2026, 10:41:43 AM (yesterday) Mar 4
        to Kentaro Hara, Stephen Nusko, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
        Attention needed from Kentaro Hara and Stephen Nusko

        Hongchan Choi added 2 comments

        Patchset-level comments
        Hongchan Choi . resolved

        This is a re-land of crrev.com/c/7586396. The additional change is only in the Blink WebAudio (t/b/r/modules/webaudio) and already reviewed by mjwilson@, and **other changes remain the same**.

        PTAL haraken@ - everything else outside of t/b/r/p/audio/*
        PTAL nuskos@ - t/b/r/p/wft/allocator/*

        File third_party/blink/renderer/platform/audio/audio_bus.cc
        Line 60, Patchset 1: return nullptr;
        Michael Wilson . resolved

        It seems like the normal AudioBus::Create can also fail. Would it be better to migrate all creation to `TryCreate` here too?

        Hongchan Choi

        Done.

        Michael Wilson

        Sorry, I wasn't clear with my comment.

        Since the normal `Create` method can actually return `nullptr`, it is effectively already a `TryCreate`. So, I think for clarity it would be better to remove the `Create` method and only use the `TryCreate` method for this class.

        Hongchan Choi

        I’d prefer to replace the original create method in a follow-up CL. This change is already quite vertical, and I want to keep the scope of this CL focused to make it more manageable.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Kentaro Hara
        • Stephen Nusko
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not 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: I2b53473ce808dc0f420493020763ba1be37fe31b
          Gerrit-Change-Number: 7624386
          Gerrit-PatchSet: 2
          Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
          Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
          Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
          Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
          Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
          Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
          Gerrit-Attention: Kentaro Hara <har...@chromium.org>
          Gerrit-Comment-Date: Wed, 04 Mar 2026 15:41:33 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Kentaro Hara (Gerrit)

          unread,
          Mar 4, 2026, 11:04:06 AM (yesterday) Mar 4
          to Hongchan Choi, Stephen Nusko, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
          Attention needed from Hongchan Choi and Stephen Nusko

          Kentaro Hara voted Code-Review+1

          Code-Review+1
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Hongchan Choi
          • Stephen Nusko
          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: I2b53473ce808dc0f420493020763ba1be37fe31b
          Gerrit-Change-Number: 7624386
          Gerrit-PatchSet: 2
          Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
          Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
          Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
          Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
          Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
          Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
          Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
          Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
          Gerrit-Comment-Date: Wed, 04 Mar 2026 16:03:55 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Stephen Nusko (Gerrit)

          unread,
          1:47 AM (12 hours ago) 1:47 AM
          to Hongchan Choi, Kentaro Hara, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org
          Attention needed from Hongchan Choi

          Stephen Nusko voted and added 3 comments

          Votes added by Stephen Nusko

          Code-Review+1

          3 comments

          File third_party/blink/public/platform/web_audio_bus.h
          Line 49, Patchset 2 (Latest): // Similar to Initialize, but returns false if allocation fails.
          Stephen Nusko . unresolved

          nit: Initialize seems to have been removed this comment needs updating.

          File third_party/blink/renderer/modules/webaudio/audio_node_input.cc
          Line 48, Patchset 2 (Latest): internal_summing_bus_ = AudioBus::TryCreate(1, 1);
          Stephen Nusko . unresolved

          Are we introducing any bounds potentially errors where it assumes the size of the buffer?

          I.E. is AudioBus properly spanified already so this sort of incorect mismatch (the size doesn't match RenderQuantumFrames anymore) won't become an OOB security bug? (I'd prefer crashing to a security bug).

          Should we have some sort of "dummy" AudioBus if this has to be a valid pointer, but that checks if anyone accesses it?

          Feel free to ignore this if you don't consider this a problem, but I wanted to raise the concern for you to consider.

          File third_party/blink/renderer/modules/webaudio/offline_audio_destination_handler.cc
          Line 149, Patchset 2 (Latest): render_bus_ = AudioBus::TryCreate(render_target->numberOfChannels(), 1);
          Stephen Nusko . unresolved

          Similar question here about OOB potential.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Hongchan Choi
          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: I2b53473ce808dc0f420493020763ba1be37fe31b
            Gerrit-Change-Number: 7624386
            Gerrit-PatchSet: 2
            Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
            Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
            Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
            Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
            Gerrit-Attention: Hongchan Choi <hong...@chromium.org>
            Gerrit-Comment-Date: Thu, 05 Mar 2026 06:46:43 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Hongchan Choi (Gerrit)

            unread,
            12:34 PM (2 hours ago) 12:34 PM
            to Stephen Nusko, Kentaro Hara, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, feature-me...@chromium.org, kinuko...@chromium.org

            Hongchan Choi voted and added 4 comments

            Votes added by Hongchan Choi

            Commit-Queue+1

            4 comments

            Patchset-level comments
            File-level comment, Patchset 3 (Latest):
            Hongchan Choi . resolved

            Thank you all for the review!

            File third_party/blink/public/platform/web_audio_bus.h
            Line 49, Patchset 2: // Similar to Initialize, but returns false if allocation fails.
            Stephen Nusko . resolved

            nit: Initialize seems to have been removed this comment needs updating.

            Hongchan Choi

            Good catch! Done.

            File third_party/blink/renderer/modules/webaudio/audio_node_input.cc
            Line 48, Patchset 2: internal_summing_bus_ = AudioBus::TryCreate(1, 1);
            Stephen Nusko . resolved

            Are we introducing any bounds potentially errors where it assumes the size of the buffer?

            I.E. is AudioBus properly spanified already so this sort of incorect mismatch (the size doesn't match RenderQuantumFrames anymore) won't become an OOB security bug? (I'd prefer crashing to a security bug).

            Should we have some sort of "dummy" AudioBus if this has to be a valid pointer, but that checks if anyone accesses it?

            Feel free to ignore this if you don't consider this a problem, but I wanted to raise the concern for you to consider.

            Hongchan Choi

            Thanks for raising this important point. To address the OOB concern, I've updated the fallback to allocate a 0-frame AudioBus instead of a 1-frame one.

            This keeps the pointer valid to satisfy C++ assumptions during object destruction, but ensures that any processing loop (which iterates based on the bus length) will safely and immediately exit, completely avoiding any OOB writes.

            Furthermore, if this fallback is triggered, HasAllocationFailed() is set to true. This causes the context creation to immediately throw a NotSupportedError and abort. As a result, the audio thread is never started and this dummy bus is never actually accessed for processing.

            File third_party/blink/renderer/modules/webaudio/offline_audio_destination_handler.cc
            Line 149, Patchset 2: render_bus_ = AudioBus::TryCreate(render_target->numberOfChannels(), 1);
            Stephen Nusko . resolved

            Similar question here about OOB potential.

            Hongchan Choi

            Similarly with the node input above. Done.

            Open in Gerrit

            Related details

            Attention set is empty
            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: I2b53473ce808dc0f420493020763ba1be37fe31b
              Gerrit-Change-Number: 7624386
              Gerrit-PatchSet: 3
              Gerrit-Owner: Hongchan Choi <hong...@chromium.org>
              Gerrit-Reviewer: Hongchan Choi <hong...@chromium.org>
              Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
              Gerrit-Reviewer: Michael Wilson <mjwi...@chromium.org>
              Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
              Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
              Gerrit-Comment-Date: Thu, 05 Mar 2026 17:34:18 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: Yes
              Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
              satisfied_requirement
              open
              diffy
              Reply all
              Reply to author
              Forward
              0 new messages