Silence upcoming -Wunsafe-buffer-usage warnings
An upcoming Clang change (https://github.com/llvm/llvm-project/pull/91991) makes -Wunsafe-buffer-usage warn on member initializers and member initializer list, so this patch silences those warnings. Bug: 377326291 Change-Id: I74206f5675f64f4f754793cff2bdb388ef8965cf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6002984 Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com> Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org> Owners-Override: Nico Weber <thakis@chromium.org> Cr-Commit-Position: refs/heads/main@{#1380096}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
6ec51fa450
commit
adbc4f7ffd
cc/paint
chrome
browser
sync_file_system
drive_backend
updater
device_management
content/browser
media
renderer_host
service_worker
device/gamepad
extensions/browser
media
net/quic
third_party/blink/public/platform
ui/gfx
@@ -1,6 +1,10 @@
|
|||||||
// Copyright 2024 The Chromium Authors
|
// Copyright 2024 The Chromium Authors
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "cc/paint/path_effect.h"
|
#include "cc/paint/path_effect.h"
|
||||||
|
|
||||||
|
@@ -230,7 +230,7 @@ class BlockerUpdateTestHelper : public SyncTask {
|
|||||||
Log* log)
|
Log* log)
|
||||||
: name_(name),
|
: name_(name),
|
||||||
app_id_(app_id),
|
app_id_(app_id),
|
||||||
paths_(paths.begin(), paths.end()),
|
paths_(base::from_range, paths),
|
||||||
log_(log) {}
|
log_(log) {}
|
||||||
|
|
||||||
BlockerUpdateTestHelper(const BlockerUpdateTestHelper&) = delete;
|
BlockerUpdateTestHelper(const BlockerUpdateTestHelper&) = delete;
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "chrome/updater/device_management/dm_policy_builder_for_testing.h"
|
#include "chrome/updater/device_management/dm_policy_builder_for_testing.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "base/containers/to_vector.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
@@ -133,7 +134,7 @@ class MidiSessionClientForTesting : public midi::mojom::MidiSessionClient {
|
|||||||
|
|
||||||
class MidiHostTest : public testing::Test {
|
class MidiHostTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
MidiHostTest() : data_(kNoteOn, kNoteOn + std::size(kNoteOn)), port_id_(0) {
|
MidiHostTest() : data_(base::ToVector(kNoteOn)), port_id_(0) {
|
||||||
browser_context_ = std::make_unique<TestBrowserContext>();
|
browser_context_ = std::make_unique<TestBrowserContext>();
|
||||||
rph_ = std::make_unique<MockRenderProcessHost>(browser_context_.get());
|
rph_ = std::make_unique<MockRenderProcessHost>(browser_context_.get());
|
||||||
std::unique_ptr<FakeMidiManagerFactory> factory =
|
std::unique_ptr<FakeMidiManagerFactory> factory =
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "base/memory/safe_ref.h"
|
#include "base/memory/safe_ref.h"
|
||||||
#include "base/not_fatal_until.h"
|
#include "base/not_fatal_until.h"
|
||||||
#include "base/ranges/algorithm.h"
|
#include "base/ranges/algorithm.h"
|
||||||
|
#include "base/ranges/from_range.h"
|
||||||
#include "base/trace_event/optional_trace_event.h"
|
#include "base/trace_event/optional_trace_event.h"
|
||||||
#include "base/trace_event/typed_macros.h"
|
#include "base/trace_event/typed_macros.h"
|
||||||
#include "base/unguessable_token.h"
|
#include "base/unguessable_token.h"
|
||||||
@@ -148,7 +149,7 @@ FrameTree::NodeIterator::NodeIterator(
|
|||||||
should_descend_into_inner_trees_(should_descend_into_inner_trees),
|
should_descend_into_inner_trees_(should_descend_into_inner_trees),
|
||||||
include_delegate_nodes_for_inner_frame_trees_(
|
include_delegate_nodes_for_inner_frame_trees_(
|
||||||
include_delegate_nodes_for_inner_frame_trees),
|
include_delegate_nodes_for_inner_frame_trees),
|
||||||
queue_(starting_nodes.begin(), starting_nodes.end()) {
|
queue_(base::from_range, starting_nodes) {
|
||||||
// If `include_delegate_nodes_for_inner_frame_trees_` is true then
|
// If `include_delegate_nodes_for_inner_frame_trees_` is true then
|
||||||
// `should_descend_into_inner_trees_` must be true.
|
// `should_descend_into_inner_trees_` must be true.
|
||||||
DCHECK(!include_delegate_nodes_for_inner_frame_trees_ ||
|
DCHECK(!include_delegate_nodes_for_inner_frame_trees_ ||
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "content/browser/service_worker/service_worker_new_script_loader.h"
|
#include "content/browser/service_worker/service_worker_new_script_loader.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "content/browser/service_worker/service_worker_single_script_update_checker.h"
|
#include "content/browser/service_worker/service_worker_single_script_update_checker.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "base/containers/to_vector.h"
|
||||||
#include "base/functional/bind.h"
|
#include "base/functional/bind.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
@@ -110,16 +111,10 @@ class FakeHidWriter : public HidWriter {
|
|||||||
class Dualshock4ControllerTest : public testing::Test {
|
class Dualshock4ControllerTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
Dualshock4ControllerTest()
|
Dualshock4ControllerTest()
|
||||||
: usb_start_vibration_report_(kUsbStartVibration,
|
: usb_start_vibration_report_(base::ToVector(kUsbStartVibration)),
|
||||||
kUsbStartVibration + kUsbReportLength),
|
usb_stop_vibration_report_(base::ToVector(kUsbStopVibration)),
|
||||||
usb_stop_vibration_report_(kUsbStopVibration,
|
bluetooth_start_vibration_report_(base::ToVector(kBtStartVibration)),
|
||||||
kUsbStopVibration + kUsbReportLength),
|
bluetooth_stop_vibration_report_(base::ToVector(kBtStopVibration)),
|
||||||
bluetooth_start_vibration_report_(
|
|
||||||
kBtStartVibration,
|
|
||||||
kBtStartVibration + kBluetoothReportLength),
|
|
||||||
bluetooth_stop_vibration_report_(
|
|
||||||
kBtStopVibration,
|
|
||||||
kBtStopVibration + kBluetoothReportLength),
|
|
||||||
callback_count_(0),
|
callback_count_(0),
|
||||||
callback_result_(
|
callback_result_(
|
||||||
mojom::GamepadHapticsResult::GamepadHapticsResultError) {
|
mojom::GamepadHapticsResult::GamepadHapticsResultError) {
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "base/containers/to_vector.h"
|
||||||
#include "base/functional/bind.h"
|
#include "base/functional/bind.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
@@ -71,10 +72,8 @@ class FakeHidWriter : public HidWriter {
|
|||||||
class HidHapticGamepadTest : public testing::Test {
|
class HidHapticGamepadTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
HidHapticGamepadTest()
|
HidHapticGamepadTest()
|
||||||
: start_vibration_output_report_(kStartVibrationData,
|
: start_vibration_output_report_(base::ToVector(kStartVibrationData)),
|
||||||
kStartVibrationData + kReportLength),
|
stop_vibration_output_report_(base::ToVector(kStopVibrationData)),
|
||||||
stop_vibration_output_report_(kStopVibrationData,
|
|
||||||
kStopVibrationData + kReportLength),
|
|
||||||
first_callback_count_(0),
|
first_callback_count_(0),
|
||||||
second_callback_count_(0),
|
second_callback_count_(0),
|
||||||
first_callback_result_(
|
first_callback_result_(
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "base/containers/to_vector.h"
|
||||||
#include "base/functional/bind.h"
|
#include "base/functional/bind.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
@@ -77,9 +78,8 @@ class FakeHidWriter : public HidWriter {
|
|||||||
class XboxHidControllerTest : public testing::Test {
|
class XboxHidControllerTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
XboxHidControllerTest()
|
XboxHidControllerTest()
|
||||||
: start_vibration_report_(kStartVibration,
|
: start_vibration_report_(base::ToVector(kStartVibration)),
|
||||||
kStartVibration + kReportLength),
|
stop_vibration_report_(base::ToVector(kStopVibration)),
|
||||||
stop_vibration_report_(kStopVibration, kStopVibration + kReportLength),
|
|
||||||
callback_count_(0),
|
callback_count_(0),
|
||||||
callback_result_(
|
callback_result_(
|
||||||
mojom::GamepadHapticsResult::GamepadHapticsResultError) {
|
mojom::GamepadHapticsResult::GamepadHapticsResultError) {
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
@@ -202,10 +202,15 @@ bool TestContentVerifyJobObserver::ObserverClient::WaitForExpectedJobs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MockContentVerifierDelegate ------------------------------------------------
|
// MockContentVerifierDelegate ------------------------------------------------
|
||||||
MockContentVerifierDelegate::MockContentVerifierDelegate()
|
MockContentVerifierDelegate::MockContentVerifierDelegate() {
|
||||||
: verifier_key_(
|
// SAFETY: Pointer arithmetic is safe because the passed values are global
|
||||||
kWebstoreSignaturesPublicKey,
|
// constants. base::ToVector(...) cannot be used because
|
||||||
kWebstoreSignaturesPublicKey + kWebstoreSignaturesPublicKeySize) {}
|
// kWebstoreSignaturesPublicKey is defined in another TU and therefore this TU
|
||||||
|
// does not know the array size.
|
||||||
|
verifier_key_ = UNSAFE_BUFFERS(std::vector<uint8_t>(
|
||||||
|
kWebstoreSignaturesPublicKey,
|
||||||
|
kWebstoreSignaturesPublicKey + kWebstoreSignaturesPublicKeySize));
|
||||||
|
}
|
||||||
|
|
||||||
MockContentVerifierDelegate::~MockContentVerifierDelegate() = default;
|
MockContentVerifierDelegate::~MockContentVerifierDelegate() = default;
|
||||||
|
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "media/base/cdm_key_information.h"
|
#include "media/base/cdm_key_information.h"
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include "base/containers/span.h"
|
#include "base/containers/span.h"
|
||||||
|
#include "base/containers/to_vector.h"
|
||||||
#include "base/memory/raw_span.h"
|
#include "base/memory/raw_span.h"
|
||||||
#include "crypto/encryptor.h"
|
#include "crypto/encryptor.h"
|
||||||
#include "crypto/symmetric_key.h"
|
#include "crypto/symmetric_key.h"
|
||||||
@@ -66,8 +67,8 @@ class AesCbcCryptoTest : public testing::Test {
|
|||||||
key2_(crypto::SymmetricKey::Import(
|
key2_(crypto::SymmetricKey::Import(
|
||||||
crypto::SymmetricKey::AES,
|
crypto::SymmetricKey::AES,
|
||||||
std::string(std::begin(kKey2), std::end(kKey2)))),
|
std::string(std::begin(kKey2), std::end(kKey2)))),
|
||||||
iv_(std::begin(kIv), std::end(kIv)),
|
iv_(kIv),
|
||||||
one_block_(std::begin(kOneBlock), std::end(kOneBlock)) {}
|
one_block_(base::ToVector(kOneBlock)) {}
|
||||||
|
|
||||||
// Encrypt |original| using AES-CBC encryption with |key| and |iv|.
|
// Encrypt |original| using AES-CBC encryption with |key| and |iv|.
|
||||||
std::vector<uint8_t> Encrypt(const std::vector<uint8_t>& original,
|
std::vector<uint8_t> Encrypt(const std::vector<uint8_t>& original,
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "media/formats/webm/webm_webvtt_parser.h"
|
#include "media/formats/webm/webm_webvtt_parser.h"
|
||||||
|
|
||||||
namespace media {
|
namespace media {
|
||||||
|
@@ -121,7 +121,7 @@ class QuicChromiumClientSessionTest
|
|||||||
default_read_(
|
default_read_(
|
||||||
std::make_unique<MockRead>(SYNCHRONOUS, ERR_IO_PENDING, 0)),
|
std::make_unique<MockRead>(SYNCHRONOUS, ERR_IO_PENDING, 0)),
|
||||||
socket_data_(std::make_unique<SequencedSocketData>(
|
socket_data_(std::make_unique<SequencedSocketData>(
|
||||||
base::make_span(default_read_.get(), 1u),
|
base::span_from_ref(*default_read_),
|
||||||
base::span<MockWrite>())),
|
base::span<MockWrite>())),
|
||||||
helper_(&clock_, &random_),
|
helper_(&clock_, &random_),
|
||||||
transport_security_state_(std::make_unique<TransportSecurityState>()),
|
transport_security_state_(std::make_unique<TransportSecurityState>()),
|
||||||
|
@@ -28,6 +28,11 @@
|
|||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_VECTOR_H_
|
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_VECTOR_H_
|
||||||
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_VECTOR_H_
|
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_VECTOR_H_
|
||||||
|
|
||||||
|
@@ -1,6 +1,10 @@
|
|||||||
// Copyright 2015 The Chromium Authors
|
// Copyright 2015 The Chromium Authors
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
#ifdef UNSAFE_BUFFERS_BUILD
|
||||||
|
// TODO(crbug.com/377326291): Remove this and convert code to safer constructs.
|
||||||
|
#pragma allow_unsafe_buffers
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef UI_GFX_VECTOR_ICON_TYPES_H_
|
#ifndef UI_GFX_VECTOR_ICON_TYPES_H_
|
||||||
#define UI_GFX_VECTOR_ICON_TYPES_H_
|
#define UI_GFX_VECTOR_ICON_TYPES_H_
|
||||||
|
Reference in New Issue
Block a user