Skip to content

Commit 5b77732

Browse files
committed
debug/elf: check if symbol section of 64-bit binary is empty to prevent panic
Originally raised in #62649. The fix (checking for empty symbols section) was only applied to the 32-bit executables flow. This commit adds the same fix for the 64-bit executables flow. Original fix: https://go-review.googlesource.com/c/go/+/528655 Updates #62649
1 parent af03343 commit 5b77732

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/debug/elf/file.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,9 @@ func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) {
689689
if err != nil {
690690
return nil, nil, fmt.Errorf("cannot load symbol section: %w", err)
691691
}
692+
if len(data) == 0 {
693+
return nil, nil, errors.New("symbol section is empty")
694+
}
692695
if len(data)%Sym64Size != 0 {
693696
return nil, nil, errors.New("length of symbol section is not a multiple of Sym64Size")
694697
}

0 commit comments

Comments
 (0)