From c6205ffbe06ee5278b27d06ef554b3f4bef52b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Moln=C3=A1r?= Date: Tue, 2 Jan 2007 18:16:16 +0100 Subject: [PATCH] tls index should be zero after decompression --- src/pefile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pefile.cpp b/src/pefile.cpp index 33e32ee4..a2fb22e3 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -968,6 +968,10 @@ void PeFile::processTls(Interval *iv) // pass 1 memcpy(otls + sizeof(tls),ibuf + tlsdatastart,sotls - sizeof(tls)); tlsindex = tlsp->tlsindex - ih.imagebase; info("TLS: %u bytes tls data and %u relocations added",sotls - (unsigned) sizeof(tls),iv->ivnum); + + // makes sure tls index is zero after decompression + if (tlsindex && tlsindex < ih.imagesize) + set_le32(ibuf + tlsindex, 0); } void PeFile::processTls(Reloc *rel,const Interval *iv,unsigned newaddr) // pass 2