Fix unsafe buffer warnings in base/token.*.
Bug: 40284755
Change-Id: Ie616e83e5de5cc801dc7affcbdd66316858f6470
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5743637
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Jan Keitel <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1333997}
diff --git a/base/token.cc b/base/token.cc
index 01d692f1..eb358734 100644
--- a/base/token.cc
+++ b/base/token.cc
@@ -2,15 +2,11 @@
// 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/40284755): Remove this and spanify to fix the errors.
-#pragma allow_unsafe_buffers
-#endif
-
#include "base/token.h"
#include <inttypes.h>
+#include <array>
#include <optional>
#include <string_view>
@@ -44,7 +40,7 @@
if (string_representation.size() != 32) {
return std::nullopt;
}
- uint64_t words[2];
+ std::array<uint64_t, 2> words;
for (size_t i = 0; i < 2; i++) {
uint64_t word = 0;
// This j loop is similar to HexStringToUInt64 but we are intentionally