From 6419a2e6974536b254918f76dc517e1bebb7bf07 Mon Sep 17 00:00:00 2001 From: Peter Kasting Date: Thu, 12 Dec 2024 12:36:31 -0800 Subject: [PATCH] Make use of `base::fixed_extent<>`. Bug: none Change-Id: Ia07ebfdd5927e545e3c19b98dc545e7f75ef46ac Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6091638 Commit-Queue: Peter Kasting Reviewed-by: Mark Mentovai --- util/misc/uuid.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/misc/uuid.cc b/util/misc/uuid.cc index fb27f27c..8ceb7ed5 100644 --- a/util/misc/uuid.cc +++ b/util/misc/uuid.cc @@ -60,12 +60,12 @@ void UUID::InitializeToZero() { void UUID::InitializeFromBytes(const uint8_t* bytes_ptr) { // TODO(crbug.com/40284755): This span construction is unsound. The caller // should provide a span instead of an unbounded pointer. - base::span bytes(bytes_ptr, sizeof(UUID)); + base::span bytes(bytes_ptr, base::fixed_extent()); data_1 = base::numerics::U32FromBigEndian(bytes.subspan<0u, 4u>()); data_2 = base::numerics::U16FromBigEndian(bytes.subspan<4u, 2u>()); data_3 = base::numerics::U16FromBigEndian(bytes.subspan<6u, 2u>()); - std::ranges::copy(bytes.subspan<8u, 2u>(), data_4); - std::ranges::copy(bytes.subspan<10u, 6u>(), data_5); + std::ranges::copy(bytes.subspan<8, 2>(), data_4); + std::ranges::copy(bytes.subspan<10, 6>(), data_5); } bool UUID::InitializeFromString(const base::StringPiece& string) {