Fix unsafe buffer usage in Windows audio code [chromium/src : main]

0 views
Skip to first unread message

Lloyd Huang (Gerrit)

unread,
May 12, 2026, 10:14:55 AM (6 days ago) May 12
to Mark Foltz, Jordan Bayles, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Jordan Bayles and Mark Foltz

Lloyd Huang added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Lloyd Huang . resolved

Hi Mark,PTAL.

Open in Gerrit

Related details

Attention is currently required from:
  • Jordan Bayles
  • Mark Foltz
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: I2eb70cf81a7da78d69571bd578de5dd7342dc8c0
Gerrit-Change-Number: 7840835
Gerrit-PatchSet: 1
Gerrit-Owner: Lloyd Huang <bzk...@gmail.com>
Gerrit-Reviewer: Jordan Bayles <jop...@chromium.org>
Gerrit-Reviewer: Lloyd Huang <bzk...@gmail.com>
Gerrit-Reviewer: Mark Foltz <mfo...@chromium.org>
Gerrit-Attention: Mark Foltz <mfo...@chromium.org>
Gerrit-Attention: Jordan Bayles <jop...@chromium.org>
Gerrit-Comment-Date: Tue, 12 May 2026 14:14:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Foltz (Gerrit)

unread,
May 13, 2026, 4:10:35 PM (5 days ago) May 13
to Lloyd Huang, Henrik Andreasson, Mark Foltz, Jordan Bayles, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Henrik Andreasson, Jordan Bayles and Lloyd Huang

Mark Foltz added 4 comments

Patchset-level comments
Mark Foltz . resolved

Thanks! A few suggestions for simpification and modernization.
+henrika as I am not very familiar with Windows audio code.

File media/audio/win/waveout_output_win.cc
Line 73, Patchset 1 (Latest): DCHECK_GE(n, 0);
Mark Foltz . unresolved

base::HeapArray will prevent out-of-bounds indexing, so these DCHECKS are redundant now.

Line 155, Patchset 1 (Latest): for (int ix = 0; ix != num_buffers_; ++ix) {
Mark Foltz . unresolved
```suggestion
for (auto& buffer : buffers_) {
```

etc.

Line 157, Patchset 1 (Latest): WAVEHDR* buffer = GetBuffer(ix);
Mark Foltz . unresolved
```suggestion
WAVEHDR& wave_hdr = buffer.header;
```
Open in Gerrit

Related details

Attention is currently required from:
  • Henrik Andreasson
  • Jordan Bayles
  • Lloyd Huang
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: I2eb70cf81a7da78d69571bd578de5dd7342dc8c0
    Gerrit-Change-Number: 7840835
    Gerrit-PatchSet: 1
    Gerrit-Owner: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Reviewer: Henrik Andreasson <hen...@chromium.org>
    Gerrit-Reviewer: Jordan Bayles <jop...@chromium.org>
    Gerrit-Reviewer: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Reviewer: Mark Foltz <mfo...@chromium.org>
    Gerrit-Attention: Henrik Andreasson <hen...@chromium.org>
    Gerrit-Attention: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Attention: Jordan Bayles <jop...@chromium.org>
    Gerrit-Comment-Date: Wed, 13 May 2026 20:10:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jordan Bayles (Gerrit)

    unread,
    May 13, 2026, 5:54:16 PM (5 days ago) May 13
    to Lloyd Huang, Henrik Andreasson, Mark Foltz, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Henrik Andreasson and Lloyd Huang

    Jordan Bayles added 1 comment

    File media/audio/win/waveout_output_win.cc
    Line 69, Patchset 1 (Latest): return buffer_size_;
    Jordan Bayles . unresolved

    Should we still have a const version of this method? or is it not needed?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Henrik Andreasson
    • Lloyd Huang
    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: I2eb70cf81a7da78d69571bd578de5dd7342dc8c0
    Gerrit-Change-Number: 7840835
    Gerrit-PatchSet: 1
    Gerrit-Owner: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Reviewer: Henrik Andreasson <hen...@chromium.org>
    Gerrit-Reviewer: Jordan Bayles <jop...@chromium.org>
    Gerrit-Reviewer: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Reviewer: Mark Foltz <mfo...@chromium.org>
    Gerrit-Attention: Henrik Andreasson <hen...@chromium.org>
    Gerrit-Attention: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Comment-Date: Wed, 13 May 2026 21:54:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Henrik Andreasson (Gerrit)

    unread,
    May 15, 2026, 5:42:02 AM (3 days ago) May 15
    to Lloyd Huang, Mark Foltz, Jordan Bayles, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Lloyd Huang

    Henrik Andreasson voted and added 2 comments

    Votes added by Henrik Andreasson

    Code-Review+1

    2 comments

    Patchset-level comments
    Henrik Andreasson . resolved

    Thanks for fixing!

    File media/audio/win/waveout_output_win.h
    Line 13, Patchset 1 (Parent):#include <stdint.h>
    Henrik Andreasson . unresolved

    You've added `#include <cstdint>`, so the existing `#include <stdint.h>` is now redundant and can be removed.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Lloyd Huang
    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: I2eb70cf81a7da78d69571bd578de5dd7342dc8c0
    Gerrit-Change-Number: 7840835
    Gerrit-PatchSet: 1
    Gerrit-Owner: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Reviewer: Henrik Andreasson <hen...@chromium.org>
    Gerrit-Reviewer: Jordan Bayles <jop...@chromium.org>
    Gerrit-Reviewer: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Reviewer: Mark Foltz <mfo...@chromium.org>
    Gerrit-Attention: Lloyd Huang <bzk...@gmail.com>
    Gerrit-Comment-Date: Fri, 15 May 2026 09:41:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Lloyd Huang (Gerrit)

    unread,
    1:25 AM (8 hours ago) 1:25 AM
    to Henrik Andreasson, Mark Foltz, Jordan Bayles, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Henrik Andreasson, Jordan Bayles and Mark Foltz

    Lloyd Huang added 5 comments

    File media/audio/win/waveout_output_win.h
    Henrik Andreasson . resolved

    You've added `#include <cstdint>`, so the existing `#include <stdint.h>` is now redundant and can be removed.

    Lloyd Huang

    Done

    File media/audio/win/waveout_output_win.cc
    Line 69, Patchset 1: return buffer_size_;
    Jordan Bayles . resolved

    Should we still have a const version of this method? or is it not needed?

    Lloyd Huang

    I removed `GetBuffer()` now that the callers iterate over `buffers_` directly, so a const overload is no longer needed.

    Line 73, Patchset 1: DCHECK_GE(n, 0);
    Mark Foltz . resolved

    base::HeapArray will prevent out-of-bounds indexing, so these DCHECKS are redundant now.

    Lloyd Huang

    Done

    Line 155, Patchset 1: for (int ix = 0; ix != num_buffers_; ++ix) {
    Mark Foltz . resolved
    ```suggestion
    for (auto& buffer : buffers_) {
    ```

    etc.

    Lloyd Huang

    Done

    Line 157, Patchset 1: WAVEHDR* buffer = GetBuffer(ix);
    Mark Foltz . resolved
    ```suggestion
    WAVEHDR& wave_hdr = buffer.header;
    ```
    Lloyd Huang

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Henrik Andreasson
    • Jordan Bayles
    • Mark Foltz
    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: I2eb70cf81a7da78d69571bd578de5dd7342dc8c0
      Gerrit-Change-Number: 7840835
      Gerrit-PatchSet: 2
      Gerrit-Owner: Lloyd Huang <bzk...@gmail.com>
      Gerrit-Reviewer: Henrik Andreasson <hen...@chromium.org>
      Gerrit-Reviewer: Jordan Bayles <jop...@chromium.org>
      Gerrit-Reviewer: Lloyd Huang <bzk...@gmail.com>
      Gerrit-Reviewer: Mark Foltz <mfo...@chromium.org>
      Gerrit-Attention: Mark Foltz <mfo...@chromium.org>
      Gerrit-Attention: Henrik Andreasson <hen...@chromium.org>
      Gerrit-Attention: Jordan Bayles <jop...@chromium.org>
      Gerrit-Comment-Date: Mon, 18 May 2026 05:25:08 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mark Foltz <mfo...@chromium.org>
      Comment-In-Reply-To: Henrik Andreasson <hen...@chromium.org>
      Comment-In-Reply-To: Jordan Bayles <jop...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jordan Bayles (Gerrit)

      unread,
      1:54 AM (7 hours ago) 1:54 AM
      to Lloyd Huang, Henrik Andreasson, Mark Foltz, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
      Attention needed from Henrik Andreasson, Lloyd Huang and Mark Foltz

      Jordan Bayles voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Henrik Andreasson
      • Lloyd Huang
      • Mark Foltz
      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: I2eb70cf81a7da78d69571bd578de5dd7342dc8c0
      Gerrit-Change-Number: 7840835
      Gerrit-PatchSet: 2
      Gerrit-Owner: Lloyd Huang <bzk...@gmail.com>
      Gerrit-Reviewer: Henrik Andreasson <hen...@chromium.org>
      Gerrit-Reviewer: Jordan Bayles <jop...@chromium.org>
      Gerrit-Reviewer: Lloyd Huang <bzk...@gmail.com>
      Gerrit-Reviewer: Mark Foltz <mfo...@chromium.org>
      Gerrit-Attention: Mark Foltz <mfo...@chromium.org>
      Gerrit-Attention: Henrik Andreasson <hen...@chromium.org>
      Gerrit-Attention: Lloyd Huang <bzk...@gmail.com>
      Gerrit-Comment-Date: Mon, 18 May 2026 05:53:46 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Kelsen Liu (Gerrit)

      unread,
      2:29 AM (7 hours ago) 2:29 AM
      to Lloyd Huang, Jordan Bayles, Henrik Andreasson, Mark Foltz, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
      Attention needed from Henrik Andreasson, Lloyd Huang and Mark Foltz

      Kelsen Liu voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Henrik Andreasson
      • Lloyd Huang
      • Mark Foltz
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement 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: I2eb70cf81a7da78d69571bd578de5dd7342dc8c0
        Gerrit-Change-Number: 7840835
        Gerrit-PatchSet: 2
        Gerrit-Owner: Lloyd Huang <bzk...@gmail.com>
        Gerrit-Reviewer: Henrik Andreasson <hen...@chromium.org>
        Gerrit-Reviewer: Jordan Bayles <jop...@chromium.org>
        Gerrit-Reviewer: Kelsen Liu <kels...@chromium.org>
        Gerrit-Reviewer: Lloyd Huang <bzk...@gmail.com>
        Gerrit-Reviewer: Mark Foltz <mfo...@chromium.org>
        Gerrit-Attention: Mark Foltz <mfo...@chromium.org>
        Gerrit-Attention: Henrik Andreasson <hen...@chromium.org>
        Gerrit-Attention: Lloyd Huang <bzk...@gmail.com>
        Gerrit-Comment-Date: Mon, 18 May 2026 06:29:02 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages