mirror of
https://github.com/anchore/syft
synced 2024-11-12 23:27:20 +00:00
fix: update graalvm cataloger to fix panic (#1454)
Fixes https://github.com/anchore/syft/issues/1453
This commit is contained in:
parent
e87cfe7319
commit
ac94bf530c
1 changed files with 9 additions and 2 deletions
|
@ -231,8 +231,15 @@ func newPE(filename string, r io.ReaderAt) (nativeImage, error) {
|
|||
if err != nil {
|
||||
return fileError(filename, err)
|
||||
}
|
||||
optionalHeader := bi.OptionalHeader.(*pe.OptionalHeader64)
|
||||
exportSymbolsDataDirectory := optionalHeader.DataDirectory[0]
|
||||
var exportSymbolsDataDirectory pe.DataDirectory
|
||||
switch h := bi.OptionalHeader.(type) {
|
||||
case *pe.OptionalHeader32:
|
||||
exportSymbolsDataDirectory = h.DataDirectory[0]
|
||||
case *pe.OptionalHeader64:
|
||||
exportSymbolsDataDirectory = h.DataDirectory[0]
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to get exportSymbolsDataDirectory from binary: %s", filename)
|
||||
}
|
||||
// If we have no exported symbols it is not a Native Image
|
||||
if exportSymbolsDataDirectory.Size == 0 {
|
||||
return fileError(filename, errors.New(nativeImageMissingExportedDataDirectoryError))
|
||||
|
|
Loading…
Reference in a new issue