fix: -Wunsafe-buffer-usage warning in asar_util's ReadFileToString() (#43930)

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-09-25 11:21:47 +02:00 committed by GitHub
parent f609d77e29
commit 1af736bc15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,11 +126,8 @@ bool ReadFileToString(const base::FilePath& path, std::string* contents) {
return false;
contents->resize(info.size);
if (static_cast<int>(info.size) !=
src.Read(info.offset, const_cast<char*>(contents->data()),
contents->size())) {
if (!src.ReadAndCheck(info.offset, base::as_writable_byte_span(*contents)))
return false;
}
if (info.integrity)
ValidateIntegrityOrDie(base::as_byte_span(*contents), *info.integrity);