■ ■ ■ ■ ■ ■
syft/pkg/cataloger/java/graalvm_native_image_cataloger.go
| skipped 230 lines |
231 | 231 | | if err != nil { |
232 | 232 | | return fileError(filename, err) |
233 | 233 | | } |
234 | | - | optionalHeader := bi.OptionalHeader.(*pe.OptionalHeader64) |
235 | | - | exportSymbolsDataDirectory := optionalHeader.DataDirectory[0] |
| 234 | + | var exportSymbolsDataDirectory pe.DataDirectory |
| 235 | + | switch h := bi.OptionalHeader.(type) { |
| 236 | + | case *pe.OptionalHeader32: |
| 237 | + | exportSymbolsDataDirectory = h.DataDirectory[0] |
| 238 | + | case *pe.OptionalHeader64: |
| 239 | + | exportSymbolsDataDirectory = h.DataDirectory[0] |
| 240 | + | default: |
| 241 | + | return nil, fmt.Errorf("unable to get exportSymbolsDataDirectory from binary: %s", filename) |
| 242 | + | } |
236 | 243 | | // If we have no exported symbols it is not a Native Image |
237 | 244 | | if exportSymbolsDataDirectory.Size == 0 { |
238 | 245 | | return fileError(filename, errors.New(nativeImageMissingExportedDataDirectoryError)) |
| skipped 313 lines |