mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1485325 - Avoid nsTSubstring::GetMutableData() in URL classifier. r=francois
MozReview-Commit-ID: EzyOTuEZ9Ot Differential Revision: https://phabricator.services.mozilla.com/D3966 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
cac0bc6570
commit
f7d4cef573
@ -282,13 +282,12 @@ HashStore::CheckChecksum(uint32_t aFileSize)
|
||||
// comparing the stored checksum to actual checksum of data
|
||||
nsAutoCString hash;
|
||||
nsAutoCString compareHash;
|
||||
char *data;
|
||||
uint32_t read;
|
||||
|
||||
nsresult rv = CalculateChecksum(hash, aFileSize, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
compareHash.GetMutableData(&data, hash.Length());
|
||||
compareHash.SetLength(hash.Length());
|
||||
|
||||
if (hash.Length() > aFileSize) {
|
||||
NS_WARNING("SafeBrowing file not long enough to store its hash");
|
||||
@ -298,7 +297,7 @@ HashStore::CheckChecksum(uint32_t aFileSize)
|
||||
rv = seekIn->Seek(nsISeekableStream::NS_SEEK_SET, aFileSize - hash.Length());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mInputStream->Read(data, hash.Length(), &read);
|
||||
rv = mInputStream->Read(compareHash.BeginWriting(), hash.Length(), &read);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ASSERTION(read == hash.Length(), "Could not read hash bytes");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user