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;