Skip to content

Commit

Permalink
proc: do not check sizes in not loadable sections
Browse files Browse the repository at this point in the history
JIRA: RTOS-912
  • Loading branch information
badochov committed Oct 2, 2024
1 parent 83ffd64 commit cb7fddd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions proc/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,11 @@ static int process_validateElf32(void *iehdr, size_t size)
return -ENOEXEC;
}
for (i = 0; i < ehdr->e_phnum; i++) {
if ((phdr->p_type != PT_LOAD) &&
(process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0)) {
return -ENOEXEC;
if (phdr->p_type != PT_LOAD) {
if (process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0) {
return -ENOEXEC;
}
continue;
}

offs = phdr->p_offset & ~(phdr->p_align - 1);
Expand Down Expand Up @@ -432,9 +434,11 @@ static int process_validateElf64(void *iehdr, size_t size)
return -ENOEXEC;
}
for (i = 0; i < ehdr->e_phnum; i++) {
if ((phdr->p_type != PT_LOAD) &&
(process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0)) {
return -ENOEXEC;
if (phdr->p_type != PT_LOAD) {
if (process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0) {
return -ENOEXEC;
}
continue;
}

offs = phdr->p_offset & ~(phdr->p_align - 1);
Expand Down

0 comments on commit cb7fddd

Please sign in to comment.