fix: deprecated API and -Wunsafe-buffer-usage warnings in AsarFileValidator (#44105)

* refactor: const correctness

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: extract-method AsarFileValidator::EnsureHashExists()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: replace use of deprecated crypto API

https://crbug.com/364687923

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: use span API in AsarFileValidator::OnRead()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: replace use of deprecated crypto API

https://crbug.com/364687923

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fixup! refactor: use span API in AsarFileValidator::OnRead()

fix: electron-ia32-testing FTBFS

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-10-02 19:13:34 -05:00 committed by GitHub
parent bd0277923f
commit 86d86768b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 48 deletions

View file

@ -36,6 +36,8 @@ class AsarFileValidator : public mojo::FilteredDataSource::Filter {
bool FinishBlock();
private:
void EnsureBlockHashExists();
base::File file_;
IntegrityPayload integrity_;
@ -52,7 +54,7 @@ class AsarFileValidator : public mojo::FilteredDataSource::Filter {
bool done_reading_ = false;
int current_block_;
int max_block_;
uint64_t current_hash_byte_count_ = 0;
uint64_t current_hash_byte_count_ = 0U;
uint64_t total_hash_byte_count_ = 0;
std::unique_ptr<crypto::SecureHash> current_hash_;
};