carbonblack / binee

Binee: binary emulation environment
GNU General Public License v2.0
503 stars 73 forks source link

type assertion panic in `windows/loader.go`: interface conversion: interface {} is *pefile.OptionalHeader32P, not *pefile.OptionalHeader32 #31

Closed mewmew closed 4 years ago

mewmew commented 5 years ago

Running binee foo_32.exe results in the following type assertion panic, as the type of the optional header is not *pefile.OptionalHeader32, but rather *pefile.OptionalHeader32P. See attached foo_32.exe sample.

$ binee foo_32.exe
panic: interface conversion: interface {} is *pefile.OptionalHeader32P, not *pefile.OptionalHeader32

goroutine 1 [running]:
github.com/carbonblack/binee/windows.(*WinEmulator).createLdrEntry(0xc000114900, 0xc000138100, 0x1, 0x9)
    /home/u/Desktop/binee/windows/loader.go:303 +0x3ec
github.com/carbonblack/binee/windows.(*WinEmulator).initPe(0xc000114900, 0xc000138000, 0x7ffec35b39b6, 0xa, 0x4, 0x4, 0xc000044640, 0x1, 0x1, 0xc000044600, ...)
    /home/u/Desktop/binee/windows/loader.go:826 +0xaad
github.com/carbonblack/binee/windows.New(0x7ffec35b39b6, 0xa, 0x4, 0x4, 0xc000044640, 0x1, 0x1, 0x0, 0x0, 0x0, ...)
    /home/u/Desktop/binee/windows/winemulator.go:288 +0x235b
main.main()
    /home/u/Desktop/binee/main.go:192 +0xa7b