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

Side by Side Diff: snapshot/win/process_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/end_to_end_test.py ('k') | snapshot/win/thread_snapshot_win.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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ReadLocks<Traits>(debug_critical_section_address, &extra_memory_); 337 ReadLocks<Traits>(debug_critical_section_address, &extra_memory_);
338 } 338 }
339 339
340 void ProcessSnapshotWin::AddMemorySnapshot( 340 void ProcessSnapshotWin::AddMemorySnapshot(
341 WinVMAddress address, 341 WinVMAddress address,
342 WinVMSize size, 342 WinVMSize size,
343 PointerVector<internal::MemorySnapshotWin>* into) { 343 PointerVector<internal::MemorySnapshotWin>* into) {
344 if (size == 0) 344 if (size == 0)
345 return; 345 return;
346 346
347 // Ensure that the entire range is readable. TODO(scottmg): Consider 347 if (!process_reader_.GetProcessInfo().LoggingRangeIsFullyReadable(
348 // generalizing this as part of 348 CheckedRange<WinVMAddress, WinVMSize>(address, size))) {
349 // https://code.google.com/p/crashpad/issues/detail?id=59.
350 auto ranges = process_reader_.GetProcessInfo().GetReadableRanges(
351 CheckedRange<WinVMAddress, WinVMSize>(address, size));
352 if (ranges.size() != 1) {
353 LOG(ERROR) << base::StringPrintf(
354 "range at 0x%llx, size 0x%llx fully unreadable", address, size);
355 return;
356 }
357 if (ranges[0].base() != address || ranges[0].size() != size) {
358 LOG(ERROR) << base::StringPrintf(
359 "some of range at 0x%llx, size 0x%llx unreadable", address, size);
360 return; 349 return;
361 } 350 }
362 351
363 // If we have already added this exact range, don't add it again. This is 352 // If we have already added this exact range, don't add it again. This is
364 // useful for the LDR module lists which are a set of doubly-linked lists, all 353 // useful for the LDR module lists which are a set of doubly-linked lists, all
365 // pointing to the same module name strings. 354 // pointing to the same module name strings.
366 // TODO(scottmg): A more general version of this, handling overlapping, 355 // TODO(scottmg): A more general version of this, handling overlapping,
367 // contained, etc. https://code.google.com/p/crashpad/issues/detail?id=61. 356 // contained, etc. https://code.google.com/p/crashpad/issues/detail?id=61.
368 for (const auto& memory_snapshot : *into) { 357 for (const auto& memory_snapshot : *into) {
369 if (memory_snapshot->Address() == address && 358 if (memory_snapshot->Address() == address &&
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // ProcessLocksList.Flink. 511 // ProcessLocksList.Flink.
523 current_address = 512 current_address =
524 critical_section_debug.ProcessLocksList.Flink - 513 critical_section_debug.ProcessLocksList.Flink -
525 offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>, 514 offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>,
526 ProcessLocksList); 515 ProcessLocksList);
527 } while (current_address != start_address_forward && 516 } while (current_address != start_address_forward &&
528 current_address != kInvalid); 517 current_address != kInvalid);
529 } 518 }
530 519
531 } // namespace crashpad 520 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/win/end_to_end_test.py ('k') | snapshot/win/thread_snapshot_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698