0

Remove file-wide unsafe buffer suppression from content/ [7 of N]

Bug: 342213636
Change-Id: Ie87253a13b7a9412782c86f79ad5b3318c8b876e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6344995
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1432249}
This commit is contained in:
Tom Sepez
2025-03-13 11:16:28 -07:00
committed by Chromium LUCI CQ
parent 1e2da97a39
commit d3b0d8da1f
5 changed files with 5 additions and 28 deletions

@ -2,17 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "content/renderer/media/audio_decoder.h"
#include <stdint.h>
#include <vector>
#include "base/compiler_specific.h"
#include "base/containers/span_writer.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
@ -74,8 +70,8 @@ bool DecodeAudioFileData(
std::vector<base::SpanWriter<float>> dest_channels;
dest_channels.reserve(number_of_channels);
for (size_t ch = 0; ch < number_of_channels; ++ch) {
dest_channels.emplace_back(base::span(destination_bus->ChannelData(ch),
destination_bus->length()));
dest_channels.emplace_back(UNSAFE_TODO(base::span(
destination_bus->ChannelData(ch), destination_bus->length())));
}
// Append all `decoded_audio_packets`, channel per channel.

@ -2,11 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "content/renderer/mhtml_handle_writer.h"
#include "base/containers/span.h"

@ -2,11 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "content/renderer/render_thread_impl.h"
#include <algorithm>

@ -2,11 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "content/renderer/renderer_blink_platform_impl.h"
#include <algorithm>

@ -2,11 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "content/renderer/v8_value_converter_impl.h"
#include <stddef.h>
@ -20,6 +15,7 @@
#include <utility>
#include <vector>
#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
@ -518,7 +514,7 @@ std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8ArrayBuffer(
const auto* data = static_cast<const uint8_t*>(array_buffer->Data());
const size_t byte_length = array_buffer->ByteLength();
return base::Value::ToUniquePtrValue(
base::Value(base::span(data, byte_length)));
base::Value(UNSAFE_TODO(base::span(data, byte_length))));
}
if (val->IsArrayBufferView()) {
v8::Local<v8::ArrayBufferView> view = val.As<v8::ArrayBufferView>();