From 8f5d83b9e3cdaae51da1ea940e658e6615a68497 Mon Sep 17 00:00:00 2001 From: Vlad Tsyrklevich Date: Fri, 21 Dec 2018 14:07:06 -0800 Subject: [PATCH] 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 Commit-Queue: Vlad Tsyrklevich --- util/process/process_memory_range.cc | 6 +++--- util/process/process_memory_range.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/util/process/process_memory_range.cc b/util/process/process_memory_range.cc index aee8c808..caa4315f 100644 --- a/util/process/process_memory_range.cc +++ b/util/process/process_memory_range.cc @@ -67,7 +67,7 @@ bool ProcessMemoryRange::RestrictRange(VMAddress base, VMSize size) { } bool ProcessMemoryRange::Read(VMAddress address, - size_t size, + VMSize size, void* buffer) const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); CheckedVMAddressRange read_range(range_.Is64Bit(), address, size); @@ -79,14 +79,14 @@ bool ProcessMemoryRange::Read(VMAddress address, } bool ProcessMemoryRange::ReadCStringSizeLimited(VMAddress address, - size_t size, + VMSize size, std::string* string) const { INITIALIZATION_STATE_DCHECK_VALID(initialized_); if (!range_.ContainsValue(address)) { LOG(ERROR) << "read out of range"; return false; } - size = std::min(size, base::checked_cast(range_.End() - address)); + size = std::min(size, range_.End() - address); return memory_->ReadCStringSizeLimited(address, size, string); } diff --git a/util/process/process_memory_range.h b/util/process/process_memory_range.h index 2b654ba1..aabee498 100644 --- a/util/process/process_memory_range.h +++ b/util/process/process_memory_range.h @@ -97,7 +97,7 @@ class ProcessMemoryRange { //! //! \return `true` on success, with \a buffer filled appropriately. `false` on //! 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 //! string in the current process. @@ -113,7 +113,7 @@ class ProcessMemoryRange { //! a `NUL` terminator is not found within \a size bytes, or when //! encountering unmapped or unreadable pages. bool ReadCStringSizeLimited(VMAddress address, - size_t size, + VMSize size, std::string* string) const; private: