WinPE: Require --strip-relocs if relocating compressed data

Thanks to @bitraid for investigating and suggestions.
https://github.com/upx/upx/issues/880
	modified:   pefile.cpp
This commit is contained in:
John Reiser 2025-10-24 08:35:20 -07:00 committed by Markus F.X.J. Oberhumer
parent 3533ebe804
commit a5f5e7fc73

View File

@ -1502,8 +1502,12 @@ void PeFile::processTls2(Reloc *const rel, const Interval *const iv, unsigned ne
kc += newaddr + sizeof(tls) - tlsp->datastart;
*p = kc + imagebase;
rel->add_reloc(kc, iv->ivarr[ic].len);
} else
rel->add_reloc(kc - imagebase, iv->ivarr[ic].len);
} else {
unsigned const a = kc - imagebase;
if (a < newaddr && !opt->win32_pe.strip_relocs)
throwCantPack("relocation too low (%#x < %#x); try --strip-relocs", a, newaddr);
rel->add_reloc(a, iv->ivarr[ic].len);
}
}
const unsigned tls_data_size = tlsp->dataend - tlsp->datastart;