mirror of
https://github.com/anchore/syft.git
synced 2026-02-14 19:46:42 +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 {
|
if err != nil {
|
||||||
return fileError(filename, err)
|
return fileError(filename, err)
|
||||||
}
|
}
|
||||||
optionalHeader := bi.OptionalHeader.(*pe.OptionalHeader64)
|
var exportSymbolsDataDirectory pe.DataDirectory
|
||||||
exportSymbolsDataDirectory := optionalHeader.DataDirectory[0]
|
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 we have no exported symbols it is not a Native Image
|
||||||
if exportSymbolsDataDirectory.Size == 0 {
|
if exportSymbolsDataDirectory.Size == 0 {
|
||||||
return fileError(filename, errors.New(nativeImageMissingExportedDataDirectoryError))
|
return fileError(filename, errors.New(nativeImageMissingExportedDataDirectoryError))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user