Skip to content

Commit ea00650

Browse files
ianlancetaylorgopherbot
authored andcommitted
debug/pe: permit symbols with no name
They are reportedly generated by llvm-mingw clang21. Fixes golang#75219 Change-Id: I7fa7e13039bc7eee826cc19826985ca0e357a9ff Reviewed-on: https://go-review.googlesource.com/c/go/+/700137 Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Michael Pratt <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Quim Muntal <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent 4cc7cc7 commit ea00650

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/debug/pe/symbol.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ func readCOFFSymbols(fh *FileHeader, r io.ReadSeeker) ([]COFFSymbol, error) {
9898
// isSymNameOffset checks symbol name if it is encoded as offset into string table.
9999
func isSymNameOffset(name [8]byte) (bool, uint32) {
100100
if name[0] == 0 && name[1] == 0 && name[2] == 0 && name[3] == 0 {
101-
return true, binary.LittleEndian.Uint32(name[4:])
101+
offset := binary.LittleEndian.Uint32(name[4:])
102+
if offset == 0 {
103+
// symbol has no name
104+
return false, 0
105+
}
106+
return true, offset
102107
}
103108
return false, 0
104109
}

0 commit comments

Comments
 (0)