Commit dfb765d0 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Chromium LUCI CQ

[fido] Fix Bugprone Clang Tidy Issues

This change fixes two small issues found by the recently proposed
bugprone clang-tidy checks [1].

[1] https://groups.google.com/a/chromium.org/g/cxx/c/hDDUlz1OMUw

Bug: None
Change-Id: I885cd1e019684f27a36265d9a11f65d554dc29f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582123Reviewed-by: default avatarNina Satragno <nsatragno@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835698}
parent 77288150
......@@ -59,9 +59,7 @@ std::vector<uint8_t> ExtractSuffix(base::span<const uint8_t> span, size_t pos) {
base::span<const uint8_t> ExtractSuffixSpan(base::span<const uint8_t> span,
size_t pos) {
if (pos > span.size())
return std::vector<uint8_t>();
return span.subspan(pos);
return span.subspan(std::min(pos, span.size()));
}
std::vector<base::span<const uint8_t>> SplitSpan(base::span<const uint8_t> span,
......
......@@ -11,7 +11,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "components/cbor/values.h"
#include "components/cbor/writer.h"
......@@ -468,10 +468,9 @@ void VirtualFidoDevice::State::InjectLargeBlob(RegistrationData* credential,
reader.Materialize().value_or(std::vector<LargeBlobData>());
if (credential->large_blob_key) {
large_blob_array.erase(base::ranges::remove_if(
large_blob_array, [&credential](const LargeBlobData& blob) {
return blob.Decrypt(*credential->large_blob_key).has_value();
}));
base::EraseIf(large_blob_array, [&credential](const LargeBlobData& blob) {
return blob.Decrypt(*credential->large_blob_key).has_value();
});
} else {
credential->large_blob_key.emplace();
base::RandBytes(credential->large_blob_key->data(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment