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

Side by Side Diff: util/win/process_info_test.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.cc ('k') | no next file » | 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE, 616 STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE,
617 handle.granted_access & STANDARD_RIGHTS_ALL); 617 handle.granted_access & STANDARD_RIGHTS_ALL);
618 EXPECT_EQ(0, handle.attributes); 618 EXPECT_EQ(0, handle.attributes);
619 } 619 }
620 } 620 }
621 EXPECT_TRUE(found_file_handle); 621 EXPECT_TRUE(found_file_handle);
622 EXPECT_TRUE(found_key_handle); 622 EXPECT_TRUE(found_key_handle);
623 EXPECT_TRUE(found_mapping_handle); 623 EXPECT_TRUE(found_mapping_handle);
624 } 624 }
625 625
626 TEST(ProcessInfo, OutOfRangeCheck) {
627 const size_t kAllocationSize = 12345;
628 scoped_ptr<char[]> safe_memory(new char[kAllocationSize]);
629
630 ProcessInfo info;
631 info.Initialize(GetCurrentProcess());
632
633 EXPECT_TRUE(
634 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>(
635 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize)));
636 EXPECT_FALSE(info.LoggingRangeIsFullyReadable(
637 CheckedRange<WinVMAddress, WinVMSize>(0, 1024)));
638 }
639
626 } // namespace 640 } // namespace
627 } // namespace test 641 } // namespace test
628 } // namespace crashpad 642 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/win/process_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698