Skip to content

Commit

Permalink
Backport https://crrev.com/c/5955393 (uplift to 1.71.x) (#26197)
Browse files Browse the repository at this point in the history
Uplift of #26191 (squashed) to release
  • Loading branch information
brave-builds authored Oct 28, 2024
1 parent ae30f5b commit ed68545
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions patches/components-safe_browsing-core-browser-db-v4_store.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/components/safe_browsing/core/browser/db/v4_store.cc b/components/safe_browsing/core/browser/db/v4_store.cc
index 8e687f813c92e49927be6089b85b9348683ef2f2..0ce972859b2acddf72c69e14b980ec3072b0927e 100644
--- a/components/safe_browsing/core/browser/db/v4_store.cc
+++ b/components/safe_browsing/core/browser/db/v4_store.cc
@@ -1007,10 +1007,11 @@ bool V4Store::VerifyChecksum() {

IteratorMap iterator_map;
HashPrefixStr next_smallest_prefix;
- InitializeIteratorMap(hash_prefix_map_->view(), &iterator_map);
- CHECK_EQ(hash_prefix_map_->view().size(), iterator_map.size());
- bool has_unmerged = GetNextSmallestUnmergedPrefix(
- hash_prefix_map_->view(), iterator_map, &next_smallest_prefix);
+ HashPrefixMapView map_view = hash_prefix_map_->view();
+ InitializeIteratorMap(map_view, &iterator_map);
+ CHECK_EQ(map_view.size(), iterator_map.size());
+ bool has_unmerged = GetNextSmallestUnmergedPrefix(map_view, iterator_map,
+ &next_smallest_prefix);

std::unique_ptr<crypto::SecureHash> checksum_ctx(
crypto::SecureHash::Create(crypto::SecureHash::SHA256));
@@ -1025,8 +1026,8 @@ bool V4Store::VerifyChecksum() {
next_smallest_prefix_size);

// Find the next smallest unmerged element in the map.
- has_unmerged = GetNextSmallestUnmergedPrefix(
- hash_prefix_map_->view(), iterator_map, &next_smallest_prefix);
+ has_unmerged = GetNextSmallestUnmergedPrefix(map_view, iterator_map,
+ &next_smallest_prefix);
}

std::array<char, crypto::kSHA256Length> checksum;

0 comments on commit ed68545

Please sign in to comment.