Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/src/main/jni/src/elf_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,18 @@ bool ElfImg::findModuleBase() {
}
}

// Step 3 (Fallback): If the pattern was not found, find the first `r--p` entry.
if (!found_block) {
LOGD("`r-xp` pattern not found. Falling back to first `r--p` entry.");
for (const auto &entry : filtered_list) {
if (strcmp(entry.perms, "r--p") == 0) {
found_block = &entry;
LOGD("Found first `r--p` block at {:#x}", found_block->start_addr);
break; // Fallback found, exit loop.
}
}
}

if (!found_block) {
LOGE("Fatal: Could not determine a base address for {}", elf.data());
return false;
Expand Down