From b711d2f750d38cc0c1b3ce27a47a73ed51feeabb Mon Sep 17 00:00:00 2001 From: John Reiser Date: Fri, 6 Apr 2018 13:42:55 -0700 Subject: [PATCH] TLS callbacks: one entry only https://github.com/upx/upx/issues/186 [partial, incomplete] (Laszlo hints there is more, but meanwhile this does fix some.) modified: pefile.cpp --- src/pefile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pefile.cpp b/src/pefile.cpp index e6074d37..03ea2fcc 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -1412,6 +1412,7 @@ void PeFile::processTls2(Reloc *rel,const Interval *iv,unsigned newaddr, { //set handler offset *(LEXX*)(otls + sotls - 2 * cb_size) = tls_handler_offset + imagebase; + *(LEXX*)(otls + sotls - 1 * cb_size) = 0; // end of one-item list //add relocation for TLS handler offset rel->add(newaddr + sotls - 2 * cb_size, reloc_type); }