Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

le: Fix segv in le.c #3927

Merged
merged 1 commit into from
Oct 19, 2023
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
13 changes: 13 additions & 0 deletions librz/bin/format/le/le.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,13 @@ static RZ_OWN LE_page *le_load_pages(rz_bin_le_obj_t *bin) {
ut32 voff = 0;
LE_page *page = &le_pages[obj->page_tbl_idx - 1];
for (ut32 i = 0; i < obj->page_tbl_entries; i++, page++) {
unsigned int pi = (obj->page_tbl_idx - 1) + i;
if (pi >= h->mpages) {
RZ_LOG_ERROR("LE: object #%u page table entry index %u is out "
"of range.\n",
oi + 1, pi + 1);
goto fail_cleanup;
}
page->obj_num = oi + 1;
page->vaddr = obj->reloc_base_addr + voff;
page->vsize = h->pagesize;
Expand Down Expand Up @@ -1016,6 +1023,12 @@ static RzVector /*<LE_map>*/ *le_create_maps(rz_bin_le_obj_t *bin) {
size_t len_before = rz_vector_len(le_maps);
ut32 beg = obj->page_tbl_idx - 1, end = beg + obj->page_tbl_entries;
for (ut32 pi = beg; pi != end; pi++) {
if (pi >= h->mpages) {
RZ_LOG_ERROR("LE: object #%u page table entry index %u is out "
"of range.\n",
oi + 1, pi + 1);
goto fail_cleanup;
}
LE_page *page = &bin->le_pages[pi];
m.first_page_num = pi + 1;
if (page->type == PAGE_LEGAL) {
Expand Down
Loading