mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 10:36:45 +01: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
@ -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…
x
Reference in New Issue
Block a user