Fix another nullptr dereference.
In this case, if the .eh_frame_hdr doesn't exist, we would crash.
Bug: 68813077
Test: Pass new unit tests, verified that without the fix, the unit test
Test: would crash.
Change-Id: I4f1365a76fe5c2fb69fa106a1ef15889c14e7611
diff --git a/libunwindstack/DwarfEhFrameWithHdr.cpp b/libunwindstack/DwarfEhFrameWithHdr.cpp
index d8cbdf4..0337dba 100644
--- a/libunwindstack/DwarfEhFrameWithHdr.cpp
+++ b/libunwindstack/DwarfEhFrameWithHdr.cpp
@@ -115,6 +115,9 @@
while (first < last) {
size_t current = (first + last) / 2;
const FdeInfo* info = GetFdeInfoFromIndex(current);
+ if (info == nullptr) {
+ return false;
+ }
if (pc == info->pc) {
*fde_offset = info->offset;
return true;
@@ -127,6 +130,9 @@
}
if (last != 0) {
const FdeInfo* info = GetFdeInfoFromIndex(last - 1);
+ if (info == nullptr) {
+ return false;
+ }
*fde_offset = info->offset;
return true;
}