diff options
| author | 2018-07-09 16:18:27 -0700 | |
|---|---|---|
| committer | 2018-07-09 16:18:27 -0700 | |
| commit | 21f7ac143b8c680efad7b74e3c3a937839b98f64 (patch) | |
| tree | 16f6b0f9ef3261da615af47ff656d7686fbb7b1e | |
| parent | e824cfdcfd41d400237a806ff93caca7f2e51878 (diff) | |
Handle FixUpRemotePointer for external images
In the case a pointer belongs to another image, return null instead
of aborting.
Bug: 111273303
Test: manual
Change-Id: I763a2ea4174614f4c3f37d26e63fc18f8266d9b6
| -rw-r--r-- | imgdiag/imgdiag.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc index dea92e0cce..24ee0892dc 100644 --- a/imgdiag/imgdiag.cc +++ b/imgdiag/imgdiag.cc @@ -176,8 +176,11 @@ static T* FixUpRemotePointer(T* remote_ptr, uintptr_t remote = reinterpret_cast<uintptr_t>(remote_ptr); - CHECK_LE(boot_map.start, remote); - CHECK_GT(boot_map.end, remote); + // In the case the remote pointer is out of range, it probably belongs to another image. + // Just return null for this case. + if (remote < boot_map.start || remote >= boot_map.end) { + return nullptr; + } off_t boot_offset = remote - boot_map.start; |