mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-28 07:48:14 +08:00
Explicitly check mach_vm_read() size out parameter
Explicitly check that mach_vm_read() successfully read the entire requested region. This is a speculative fix for an infrequent crash that occurs in the wild where only part of the region read by ReadMapped() was actually mapped into memory. Bug: chromium:918626 Change-Id: I4f4b3902d11480dc4a003608cfb1d371ec89425b Reviewed-on: https://chromium-review.googlesource.com/c/1455170 Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
03850fb6cf
commit
25ba1d6895
@ -94,8 +94,16 @@ std::unique_ptr<ProcessMemoryMac::MappedMemory> ProcessMemoryMac::ReadMapped(
|
||||
"mach_vm_read(0x%llx, 0x%llx)", region_address, region_size);
|
||||
return std::unique_ptr<MappedMemory>();
|
||||
}
|
||||
if (region_count != region_size) {
|
||||
LOG(ERROR) << base::StringPrintf(
|
||||
"mach_vm_read() unexpected read: 0x%x != 0x%llx bytes",
|
||||
region_count,
|
||||
region_size);
|
||||
if (region_count)
|
||||
vm_deallocate(mach_task_self(), region, region_count);
|
||||
return std::unique_ptr<MappedMemory>();
|
||||
}
|
||||
|
||||
DCHECK_EQ(region_count, region_size);
|
||||
return std::unique_ptr<MappedMemory>(
|
||||
new MappedMemory(region, region_size, address - region_address, size));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user