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

Side by Side Diff: util/win/process_info.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 | « util/win/process_info.h ('k') | util/win/process_info_test.cc » ('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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 593 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
594 return memory_info_; 594 return memory_info_;
595 } 595 }
596 596
597 std::vector<CheckedRange<WinVMAddress, WinVMSize>> 597 std::vector<CheckedRange<WinVMAddress, WinVMSize>>
598 ProcessInfo::GetReadableRanges( 598 ProcessInfo::GetReadableRanges(
599 const CheckedRange<WinVMAddress, WinVMSize>& range) const { 599 const CheckedRange<WinVMAddress, WinVMSize>& range) const {
600 return GetReadableRangesOfMemoryMap(range, MemoryInfo()); 600 return GetReadableRangesOfMemoryMap(range, MemoryInfo());
601 } 601 }
602 602
603 bool ProcessInfo::LoggingRangeIsFullyReadable(
604 const CheckedRange<WinVMAddress, WinVMSize>& range) const {
605 const auto ranges = GetReadableRanges(range);
606 if (ranges.size() != 1) {
607 LOG(ERROR) << base::StringPrintf(
608 "range at 0x%llx, size 0x%llx fully unreadable",
609 range.base(),
610 range.size());
611 return false;
612 }
613 if (ranges[0].base() != range.base() || ranges[0].size() != range.size()) {
614 LOG(ERROR) << base::StringPrintf(
615 "some of range at 0x%llx, size 0x%llx unreadable",
616 range.base(),
617 range.size());
618 return false;
619 }
620 return true;
621 }
622
603 const std::vector<ProcessInfo::Handle>& ProcessInfo::Handles() const { 623 const std::vector<ProcessInfo::Handle>& ProcessInfo::Handles() const {
604 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 624 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
605 if (handles_.empty()) 625 if (handles_.empty())
606 handles_ = BuildHandleVector(process_); 626 handles_ = BuildHandleVector(process_);
607 return handles_; 627 return handles_;
608 } 628 }
609 629
610 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRangesOfMemoryMap( 630 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRangesOfMemoryMap(
611 const CheckedRange<WinVMAddress, WinVMSize>& range, 631 const CheckedRange<WinVMAddress, WinVMSize>& range,
612 const std::vector<MEMORY_BASIC_INFORMATION64>& memory_info) { 632 const std::vector<MEMORY_BASIC_INFORMATION64>& memory_info) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 } else { 683 } else {
664 result.push_back(as_ranges[i]); 684 result.push_back(as_ranges[i]);
665 } 685 }
666 DCHECK(result.back().IsValid()); 686 DCHECK(result.back().IsValid());
667 } 687 }
668 688
669 return result; 689 return result;
670 } 690 }
671 691
672 } // namespace crashpad 692 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/win/process_info.h ('k') | util/win/process_info_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698