Change ProcessMemoryRange to use VMSize

Follow up to https://crrev.com/c/1387756 replace size_t with VMSize.

Bug: crashpad:270
Change-Id: I22ac9e3503ef3e9707b2ad0758ae133c5a746f27
Reviewed-on: https://chromium-review.googlesource.com/c/1389235
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
This commit is contained in:
Vlad Tsyrklevich 2018-12-21 14:07:06 -08:00 committed by Commit Bot
parent bcce074143
commit 8f5d83b9e3
2 changed files with 5 additions and 5 deletions

View File

@ -67,7 +67,7 @@ bool ProcessMemoryRange::RestrictRange(VMAddress base, VMSize size) {
} }
bool ProcessMemoryRange::Read(VMAddress address, bool ProcessMemoryRange::Read(VMAddress address,
size_t size, VMSize size,
void* buffer) const { void* buffer) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_); INITIALIZATION_STATE_DCHECK_VALID(initialized_);
CheckedVMAddressRange read_range(range_.Is64Bit(), address, size); CheckedVMAddressRange read_range(range_.Is64Bit(), address, size);
@ -79,14 +79,14 @@ bool ProcessMemoryRange::Read(VMAddress address,
} }
bool ProcessMemoryRange::ReadCStringSizeLimited(VMAddress address, bool ProcessMemoryRange::ReadCStringSizeLimited(VMAddress address,
size_t size, VMSize size,
std::string* string) const { std::string* string) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_); INITIALIZATION_STATE_DCHECK_VALID(initialized_);
if (!range_.ContainsValue(address)) { if (!range_.ContainsValue(address)) {
LOG(ERROR) << "read out of range"; LOG(ERROR) << "read out of range";
return false; return false;
} }
size = std::min(size, base::checked_cast<size_t>(range_.End() - address)); size = std::min(size, range_.End() - address);
return memory_->ReadCStringSizeLimited(address, size, string); return memory_->ReadCStringSizeLimited(address, size, string);
} }

View File

@ -97,7 +97,7 @@ class ProcessMemoryRange {
//! //!
//! \return `true` on success, with \a buffer filled appropriately. `false` on //! \return `true` on success, with \a buffer filled appropriately. `false` on
//! failure, with a message logged. //! failure, with a message logged.
bool Read(VMAddress address, size_t size, void* buffer) const; bool Read(VMAddress address, VMSize size, void* buffer) const;
//! \brief Reads a `NUL`-terminated C string from the target process into a //! \brief Reads a `NUL`-terminated C string from the target process into a
//! string in the current process. //! string in the current process.
@ -113,7 +113,7 @@ class ProcessMemoryRange {
//! a `NUL` terminator is not found within \a size bytes, or when //! a `NUL` terminator is not found within \a size bytes, or when
//! encountering unmapped or unreadable pages. //! encountering unmapped or unreadable pages.
bool ReadCStringSizeLimited(VMAddress address, bool ReadCStringSizeLimited(VMAddress address,
size_t size, VMSize size,
std::string* string) const; std::string* string) const;
private: private: