Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/driver/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ mapping:
// Llvm buildid protocol: the first two characters of the build id
// are used as directory, and the remaining part is in the filename.
// e.g. `/ab/cdef0123456.debug`
fileNames = append(fileNames, filepath.Join(path, m.BuildID[:2], m.BuildID[2:]+".debug"))
if len(m.BuildID) >= 2 {
fileNames = append(fileNames, filepath.Join(path, m.BuildID[:2], m.BuildID[2:]+".debug"))
}
}
if m.File != "" {
// Try both the basename and the full path, to support the same directory
Expand Down
4 changes: 4 additions & 0 deletions internal/driver/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func TestSymbolizationPath(t *testing.T) {
{"", "", "fghij10001", filepath.Join(tempdir, "pprof/binaries/fg/hij10001.debug"), 0},
{"/nowhere:/alternate/architecture", "/usr/bin/binary", "fedcb10000", "/usr/bin/binary", 1},
{"/nowhere:/alternate/architecture", "/usr/bin/binary", "abcde10002", "/usr/bin/binary", 1},
// A single-character BuildID must not panic when the LLVM debug-file
// lookup slices BuildID[:2] / BuildID[2:]. Prior to the fix, this caused
// a "slice bounds out of range" panic.
{"", "/usr/bin/binary", "X", "/usr/bin/binary", 0},
} {
os.Setenv("PPROF_BINARY_PATH", tc.env)
p := &profile.Profile{
Expand Down
Loading