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

Unified Diff: chrome/browser/task_manager/sampling/shared_sampler_win.cc

Issue 2566423002: Fix SharedSampler to cope correctly with zero-thread processes. (Closed)
Patch Set: Fix >= to > Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/task_manager/sampling/shared_sampler_win.cc
diff --git a/chrome/browser/task_manager/sampling/shared_sampler_win.cc b/chrome/browser/task_manager/sampling/shared_sampler_win.cc
index 4cd06e986356e47e9d70536d15eb17bc3df8475d..e54e2f8295795c7be25563d0f41d3d330498eecf 100644
--- a/chrome/browser/task_manager/sampling/shared_sampler_win.cc
+++ b/chrome/browser/task_manager/sampling/shared_sampler_win.cc
@@ -457,10 +457,12 @@ std::unique_ptr<ProcessDataSnapshot> SharedSampler::CaptureSnapshot() {
// the buffer boundary.
if (offset + sizeof(SYSTEM_PROCESS_INFORMATION) > data_buffer.size())
break;
- if (offset + sizeof(SYSTEM_PROCESS_INFORMATION) +
- (pi->NumberOfThreads - 1) * sizeof(SYSTEM_THREAD_INFORMATION) >
- data_buffer.size())
+ if (pi->NumberOfThreads > 0 &&
+ (offset + sizeof(SYSTEM_PROCESS_INFORMATION) +
+ (pi->NumberOfThreads - 1) * sizeof(SYSTEM_THREAD_INFORMATION) >
+ data_buffer.size())) {
break;
+ }
if (pi->ImageName.Buffer) {
// Validate that the image name is within the buffer boundary.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698