diff mbox

[PULL,1/2] linux-user: Do not subtract offset from end address

Message ID ccf661f827faf700b03a30076b5f944e8f787280.1415688483.git.riku.voipio@linaro.org
State Accepted
Commit ccf661f827faf700b03a30076b5f944e8f787280
Headers show

Commit Message

Riku Voipio Nov. 11, 2014, 6:50 a.m. UTC
From: Tom Musta <tommusta@gmail.com>

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 <tommusta@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 linux-user/elfload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 84123ba..e2596a4 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1824,7 +1824,7 @@  static void load_elf_image(const char *image_name, int image_fd,
             if (a < loaddr) {
                 loaddr = a;
             }
-            a += phdr[i].p_memsz;
+            a = phdr[i].p_vaddr + phdr[i].p_memsz;
             if (a > hiaddr) {
                 hiaddr = a;
             }