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

Side by Side Diff: snapshot/win/thread_snapshot_win.cc

Issue 1412243005: win: Validate readability of memory ranges added to minidump (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « snapshot/win/process_snapshot_win.cc ('k') | util/win/process_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 23 matching lines...) Expand all
34 34
35 ThreadSnapshotWin::~ThreadSnapshotWin() { 35 ThreadSnapshotWin::~ThreadSnapshotWin() {
36 } 36 }
37 37
38 bool ThreadSnapshotWin::Initialize( 38 bool ThreadSnapshotWin::Initialize(
39 ProcessReaderWin* process_reader, 39 ProcessReaderWin* process_reader,
40 const ProcessReaderWin::Thread& process_reader_thread) { 40 const ProcessReaderWin::Thread& process_reader_thread) {
41 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); 41 INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
42 42
43 thread_ = process_reader_thread; 43 thread_ = process_reader_thread;
44 // TODO(scottmg): Ensure these regions are readable 44 if (process_reader->GetProcessInfo().LoggingRangeIsFullyReadable(
45 // https://code.google.com/p/crashpad/issues/detail?id=59 45 CheckedRange<WinVMAddress, WinVMSize>(thread_.stack_region_address,
46 stack_.Initialize( 46 thread_.stack_region_size))) {
47 process_reader, thread_.stack_region_address, thread_.stack_region_size); 47 stack_.Initialize(process_reader,
48 teb_.Initialize(process_reader, thread_.teb_address, thread_.teb_size); 48 thread_.stack_region_address,
49 thread_.stack_region_size);
50 } else {
51 stack_.Initialize(process_reader, 0, 0);
52 }
53
54 if (process_reader->GetProcessInfo().LoggingRangeIsFullyReadable(
55 CheckedRange<WinVMAddress, WinVMSize>(thread_.teb_address,
56 thread_.teb_size))) {
57 teb_.Initialize(process_reader, thread_.teb_address, thread_.teb_size);
58 } else {
59 teb_.Initialize(process_reader, 0, 0);
60 }
49 61
50 #if defined(ARCH_CPU_X86_64) 62 #if defined(ARCH_CPU_X86_64)
51 if (process_reader->Is64Bit()) { 63 if (process_reader->Is64Bit()) {
52 context_.architecture = kCPUArchitectureX86_64; 64 context_.architecture = kCPUArchitectureX86_64;
53 context_.x86_64 = &context_union_.x86_64; 65 context_.x86_64 = &context_union_.x86_64;
54 InitializeX64Context(process_reader_thread.context.native, context_.x86_64); 66 InitializeX64Context(process_reader_thread.context.native, context_.x86_64);
55 } else { 67 } else {
56 context_.architecture = kCPUArchitectureX86; 68 context_.architecture = kCPUArchitectureX86;
57 context_.x86 = &context_union_.x86; 69 context_.x86 = &context_union_.x86;
58 InitializeX86Context(process_reader_thread.context.wow64, context_.x86); 70 InitializeX86Context(process_reader_thread.context.wow64, context_.x86);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 std::vector<const MemorySnapshot*> ThreadSnapshotWin::ExtraMemory() const { 112 std::vector<const MemorySnapshot*> ThreadSnapshotWin::ExtraMemory() const {
101 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 113 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
102 // TODO(scottmg): Ensure this region is readable, and make sure we don't 114 // TODO(scottmg): Ensure this region is readable, and make sure we don't
103 // discard the entire dump if it isn't. 115 // discard the entire dump if it isn't.
104 // https://code.google.com/p/crashpad/issues/detail?id=59 116 // https://code.google.com/p/crashpad/issues/detail?id=59
105 return std::vector<const MemorySnapshot*>(1, &teb_); 117 return std::vector<const MemorySnapshot*>(1, &teb_);
106 } 118 }
107 119
108 } // namespace internal 120 } // namespace internal
109 } // namespace crashpad 121 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/win/process_snapshot_win.cc ('k') | util/win/process_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698