Skip to content
Merged
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
11 changes: 9 additions & 2 deletions syft/pkg/cataloger/java/graalvm_native_image_cataloger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Comment thread
kzantow marked this conversation as resolved.
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))
Expand Down