mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
fixed computing of tls data end (sf.net bug 3256788)
This commit is contained in:
parent
d4983731e7
commit
679ad9b8c6
|
@ -252,7 +252,7 @@ void PackW32Pe::processTls(Interval *iv) // pass 1
|
||||||
// the PE loader wants this stuff uncompressed
|
// the PE loader wants this stuff uncompressed
|
||||||
otls = new upx_byte[sotls];
|
otls = new upx_byte[sotls];
|
||||||
memset(otls,0,sotls);
|
memset(otls,0,sotls);
|
||||||
memcpy(otls,ibuf + IDADDR(PEDIR_TLS),0x18);
|
memcpy(otls,ibuf + IDADDR(PEDIR_TLS),sizeof(tls));
|
||||||
// WARNING: this can acces data in BSS
|
// WARNING: this can acces data in BSS
|
||||||
memcpy(otls + sizeof(tls),ibuf + tlsdatastart,sotls - sizeof(tls));
|
memcpy(otls + sizeof(tls),ibuf + tlsdatastart,sotls - sizeof(tls));
|
||||||
tlsindex = tlsp->tlsindex - ih.imagebase;
|
tlsindex = tlsp->tlsindex - ih.imagebase;
|
||||||
|
@ -290,9 +290,9 @@ void PackW32Pe::processTls(Reloc *rel,const Interval *iv,unsigned newaddr) // pa
|
||||||
rel->add(kc - ih.imagebase,iv->ivarr[ic].len);
|
rel->add(kc - ih.imagebase,iv->ivarr[ic].len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unsigned tls_data_size = tlsp->dataend - tlsp->datastart;
|
||||||
tlsp->datastart = newaddr + sizeof(tls) + ih.imagebase;
|
tlsp->datastart = newaddr + sizeof(tls) + ih.imagebase;
|
||||||
const tls * const itlsp = (const tls*) (ibuf + IDADDR(PEDIR_TLS));
|
tlsp->dataend = tlsp->datastart + tls_data_size;
|
||||||
tlsp->dataend = tlsp->datastart + itlsp->dataend - itlsp->datastart;
|
|
||||||
|
|
||||||
//NEW: if we have TLS callbacks to handle, we create a pointer to the new callback chain - Stefan Widmann
|
//NEW: if we have TLS callbacks to handle, we create a pointer to the new callback chain - Stefan Widmann
|
||||||
tlsp->callbacks = (use_tls_callbacks ? newaddr + sotls + ih.imagebase - 8 : 0);
|
tlsp->callbacks = (use_tls_callbacks ? newaddr + sotls + ih.imagebase - 8 : 0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user