proc: do not crash if executable doesn't have a PT_TLS section (#1483)

Fixes #1481
This commit is contained in:
Alessandro Arzilli 2019-02-26 18:17:05 +01:00 committed by Derek Parker
parent 14aeea2bd9
commit 3ba4bcf488

@ -754,6 +754,10 @@ func (bi *BinaryInfo) setGStructOffsetElf(exe *elf.File, wg *sync.WaitGroup) {
break
}
}
if tls == nil {
bi.gStructOffset = ^uint64(8) + 1 // -8
return
}
memsz := tls.Memsz
memsz = (memsz + uint64(bi.Arch.PtrSize()) - 1) & ^uint64(bi.Arch.PtrSize()-1) // align to pointer-sized-boundary