Skip to content

Commit

Permalink
internal/buildinfo: do module-level analysis with no PCLN table
Browse files Browse the repository at this point in the history
No PCLN table means we just have buildinfo, which is exactly the same
scenario as when the binary is stripped. We should hence support it.

Fixes golang/go#59731

Change-Id: Ib6dd072f4827bc98bbbe5e686c81b5d72246a58b
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/560375
Reviewed-by: Maceo Thompson <maceothompson@google.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
  • Loading branch information
zpavlinovic committed Feb 5, 2024
1 parent 3b6ac80 commit c02416c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/buildinfo/additions_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ func ExtractPackagesAndSymbols(bin io.ReaderAt) ([]*packages.Module, []Symbol, *

pclntab, textOffset := x.PCLNTab()
if pclntab == nil {
// TODO(https://go.dev/issue/59731): if we have build information, but
// not PCLN table, we should be able to fall back to much higher
// granularity vulnerability checking.
return nil, nil, nil, errors.New("unable to load the PCLN table")
// If we have build information, but not PCLN table, fall
// back to much higher granularity vulnerability checking.
return debugModulesToPackagesModules(bi.Deps), nil, bi, nil
}
lineTab := gosym.NewLineTable(pclntab, textOffset)
if lineTab == nil {
Expand Down

0 comments on commit c02416c

Please sign in to comment.