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
diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc
index dea92e0..24ee089 100644
--- a/imgdiag/imgdiag.cc
+++ b/imgdiag/imgdiag.cc
@@ -176,8 +176,11 @@
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;