From eb6c51426a8adfbbb2298d240b31a47ec572eef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Moln=C3=A1r?= Date: Fri, 16 Sep 2005 10:16:51 +0000 Subject: [PATCH] fixed a nasty relocation handling error which could produce broken compressed files committer: ml1050 1126865811 +0000 --- src/p_exe.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_exe.cpp b/src/p_exe.cpp index 06029da4..c113348c 100644 --- a/src/p_exe.cpp +++ b/src/p_exe.cpp @@ -293,7 +293,9 @@ unsigned optimize_relocs(upx_byte *b, const unsigned size, { addr = get_le32(relocs+4*i); //printf ("%x\n",es*16+di); - if (addr - es*16 > 0xfffe) + if ((addr - es*16 > 0xfffe) + || (i == nrelocs - 1 && addr - es * 16 > 0xff00) + ) { // segment change t = 1+(0xffff-di)/254;