Skip to content

Commit ccf661f

Browse files
Tom MustaRiku Voipio
Tom Musta
authored and
Riku Voipio
committed
linux-user: Do not subtract offset from end address
When computing the upper address of a program segment, do not subtract the offset from the virtual address; instead compute the sum of the virtual address and the memory size. Signed-off-by: Tom Musta <[email protected]> Signed-off-by: Riku Voipio <[email protected]>
1 parent 558c2c8 commit ccf661f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linux-user/elfload.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ static void load_elf_image(const char *image_name, int image_fd,
18241824
if (a < loaddr) {
18251825
loaddr = a;
18261826
}
1827-
a += phdr[i].p_memsz;
1827+
a = phdr[i].p_vaddr + phdr[i].p_memsz;
18281828
if (a > hiaddr) {
18291829
hiaddr = a;
18301830
}

0 commit comments

Comments
 (0)