Fix several segfaults found by matalaz in PE, MACH0 and COFF