diff --git a/core/unix/rseq_linux.c b/core/unix/rseq_linux.c index 41300a080ad..08fad619860 100644 --- a/core/unix/rseq_linux.c +++ b/core/unix/rseq_linux.c @@ -581,7 +581,9 @@ rseq_process_module(module_area_t *ma, bool at_map, bool saw_glibc_rseq_reg) ELF_SECTION_HEADER_TYPE *sec_hdr = NULL; char *strtab; ssize_t load_offs = ma->start - ma->os_data.base_address; - if (at_map && elf_hdr->e_shoff + ma->start < ma->end) { + if (at_map && + elf_hdr->e_shoff + elf_hdr->e_shnum * elf_hdr->e_shentsize + ma->start < + ma->end) { sec_map = elf_hdr->e_shoff + ma->start; sec_hdr = (ELF_SECTION_HEADER_TYPE *)sec_map; /* We assume strtab is there too. */