OLD | NEW |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 void HeapChecker::GetCorruptRangesInSlab(const uint8_t* lower_bound, | 51 void HeapChecker::GetCorruptRangesInSlab(const uint8_t* lower_bound, |
52 const uint8_t* upper_bound, | 52 const uint8_t* upper_bound, |
53 CorruptRangesVector* corrupt_ranges) { | 53 CorruptRangesVector* corrupt_ranges) { |
54 DCHECK_NE(static_cast<const uint8_t*>(nullptr), lower_bound); | 54 DCHECK_NE(static_cast<const uint8_t*>(nullptr), lower_bound); |
55 DCHECK(upper_bound == nullptr || lower_bound <= upper_bound); | 55 DCHECK(upper_bound == nullptr || lower_bound <= upper_bound); |
56 DCHECK_NE(static_cast<CorruptRangesVector*>(nullptr), corrupt_ranges); | 56 DCHECK_NE(static_cast<CorruptRangesVector*>(nullptr), corrupt_ranges); |
57 | 57 |
58 // An overflowed |upper_bound| is handled correctly by the ShadowWalker. | 58 // An overflowed |upper_bound| is handled correctly by the ShadowWalker. |
59 ShadowWalker shadow_walker( | 59 ShadowWalker shadow_walker(shadow_, lower_bound, upper_bound); |
60 shadow_, false, lower_bound, upper_bound); | |
61 | 60 |
62 AsanCorruptBlockRange* current_corrupt_range = nullptr; | 61 AsanCorruptBlockRange* current_corrupt_range = nullptr; |
63 | 62 |
64 // Iterates over the blocks. | 63 // Iterates over the blocks. |
65 BlockInfo block_info = {}; | 64 BlockInfo block_info = {}; |
66 while (shadow_walker.Next(&block_info)) { | 65 while (shadow_walker.Next(&block_info)) { |
67 // Remove the protections on this block so its checksum can be safely | 66 // Remove the protections on this block so its checksum can be safely |
68 // validated. We leave the protections permanently removed so that the | 67 // validated. We leave the protections permanently removed so that the |
69 // minidump generation has free access to block contents. | 68 // minidump generation has free access to block contents. |
70 BlockProtectNone(block_info, shadow_); | 69 BlockProtectNone(block_info, shadow_); |
(...skipping 25 matching lines...) Expand all Loading... |
96 block_info.RawHeader() + block_info.block_size; | 95 block_info.RawHeader() + block_info.block_size; |
97 current_corrupt_range->length = | 96 current_corrupt_range->length = |
98 current_block_end - | 97 current_block_end - |
99 reinterpret_cast<const uint8_t*>(current_corrupt_range->address); | 98 reinterpret_cast<const uint8_t*>(current_corrupt_range->address); |
100 } | 99 } |
101 } | 100 } |
102 } | 101 } |
103 | 102 |
104 } // namespace asan | 103 } // namespace asan |
105 } // namespace agent | 104 } // namespace agent |
OLD | NEW |