Skip to content

Instantly share code, notes, and snippets.

@pellaeon
Created November 3, 2018 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pellaeon/3ce99374507c6495dad5fd94da2bf624 to your computer and use it in GitHub Desktop.
Save pellaeon/3ce99374507c6495dad5fd94da2bf624 to your computer and use it in GitHub Desktop.
Patch PrefHashStoreImpl::PrefHashStoreTransactionImpl::CheckValue
# https://github.com/Eloston/ungoogled-chromium/issues/538
--- services/preferences/tracked/pref_hash_store_impl.cc 2018-11-03 23:30:48.000000000 +0800
+++ services/preferences/tracked/pref_hash_store_impl.cc 2018-11-03 23:34:27.000000000 +0800
@@ -156,33 +156,7 @@
ValueState PrefHashStoreImpl::PrefHashStoreTransactionImpl::CheckValue(
const std::string& path,
const base::Value* initial_value) const {
- std::string last_hash;
- contents_->GetMac(path, &last_hash);
-
- if (last_hash.empty()) {
- // In the absence of a hash for this pref, always trust a NULL value, but
- // only trust an existing value if the initial hashes dictionary is trusted.
- if (!initial_value)
- return ValueState::TRUSTED_NULL_VALUE;
- else if (super_mac_valid_)
- return ValueState::TRUSTED_UNKNOWN_VALUE;
- else
- return ValueState::UNTRUSTED_UNKNOWN_VALUE;
- }
-
- PrefHashCalculator::ValidationResult validation_result =
- outer_->pref_hash_calculator_.Validate(path, initial_value, last_hash);
- switch (validation_result) {
- case PrefHashCalculator::VALID:
- return ValueState::UNCHANGED;
- case PrefHashCalculator::VALID_SECURE_LEGACY:
- return ValueState::SECURE_LEGACY;
- case PrefHashCalculator::INVALID:
- return initial_value ? ValueState::CHANGED : ValueState::CLEARED;
- }
- NOTREACHED() << "Unexpected PrefHashCalculator::ValidationResult: "
- << validation_result;
- return ValueState::UNTRUSTED_UNKNOWN_VALUE;
+ return ValueState::UNCHANGED;
}
void PrefHashStoreImpl::PrefHashStoreTransactionImpl::StoreHash(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment