Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/crashpad/crashpad/snapshot/win/capture_memory_delegate_win.cc

Issue 1921833002: Update Crashpad to 00d458adaf3868999eeab5341fce5bedb81d17a1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win fixes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/snapshot/win/capture_memory_delegate_win.cc
diff --git a/third_party/crashpad/crashpad/snapshot/win/capture_memory_delegate_win.cc b/third_party/crashpad/crashpad/snapshot/win/capture_memory_delegate_win.cc
index 1eaa4258164dd6c0726fbd6a341762a0ac59a814..889e1b20da6550f68fb30c8285fe9a3a7ee24afc 100644
--- a/third_party/crashpad/crashpad/snapshot/win/capture_memory_delegate_win.cc
+++ b/third_party/crashpad/crashpad/snapshot/win/capture_memory_delegate_win.cc
@@ -14,6 +14,7 @@
#include "snapshot/win/capture_memory_delegate_win.h"
+#include "base/numerics/safe_conversions.h"
#include "snapshot/win/memory_snapshot_win.h"
namespace crashpad {
@@ -22,10 +23,12 @@ namespace internal {
CaptureMemoryDelegateWin::CaptureMemoryDelegateWin(
ProcessReaderWin* process_reader,
const ProcessReaderWin::Thread& thread,
- PointerVector<MemorySnapshotWin>* snapshots)
+ PointerVector<MemorySnapshotWin>* snapshots,
+ uint32_t* budget_remaining)
: stack_(thread.stack_region_address, thread.stack_region_size),
process_reader_(process_reader),
- snapshots_(snapshots) {}
+ snapshots_(snapshots),
+ budget_remaining_(budget_remaining) {}
bool CaptureMemoryDelegateWin::Is64Bit() const {
return process_reader_->Is64Bit();
@@ -47,9 +50,22 @@ void CaptureMemoryDelegateWin::AddNewMemorySnapshot(
// Don't bother storing this memory if it points back into the stack.
if (stack_.ContainsRange(range))
return;
+ if (range.size() == 0)
+ return;
+ if (budget_remaining_ && *budget_remaining_ == 0)
+ return;
internal::MemorySnapshotWin* snapshot = new internal::MemorySnapshotWin();
snapshot->Initialize(process_reader_, range.base(), range.size());
snapshots_->push_back(snapshot);
+ if (budget_remaining_) {
+ if (!base::IsValueInRangeForNumericType<int64_t>(range.size())) {
+ *budget_remaining_ = 0;
+ } else {
+ int64_t temp = *budget_remaining_;
+ temp -= range.size();
+ *budget_remaining_ = base::saturated_cast<uint32_t>(temp);
+ }
+ }
}
} // namespace internal

Powered by Google App Engine
This is Rietveld 408576698