Commit e5383c68 authored by Alex Brainman's avatar Alex Brainman

debug/pe: use appropriate type for sizeofOptionalHeader32

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/157220043
parent 3ec8fe45
...@@ -125,8 +125,8 @@ func (f *File) Close() error { ...@@ -125,8 +125,8 @@ func (f *File) Close() error {
} }
var ( var (
sizeofOptionalHeader32 = uintptr(binary.Size(OptionalHeader32{})) sizeofOptionalHeader32 = uint16(binary.Size(OptionalHeader32{}))
sizeofOptionalHeader64 = uintptr(binary.Size(OptionalHeader64{})) sizeofOptionalHeader64 = uint16(binary.Size(OptionalHeader64{}))
) )
// NewFile creates a new File for accessing a PE binary in an underlying reader. // NewFile creates a new File for accessing a PE binary in an underlying reader.
...@@ -209,7 +209,7 @@ func NewFile(r io.ReaderAt) (*File, error) { ...@@ -209,7 +209,7 @@ func NewFile(r io.ReaderAt) (*File, error) {
} }
var oh32 OptionalHeader32 var oh32 OptionalHeader32
var oh64 OptionalHeader64 var oh64 OptionalHeader64
switch uintptr(f.FileHeader.SizeOfOptionalHeader) { switch f.FileHeader.SizeOfOptionalHeader {
case sizeofOptionalHeader32: case sizeofOptionalHeader32:
if err := binary.Read(sr, binary.LittleEndian, &oh32); err != nil { if err := binary.Read(sr, binary.LittleEndian, &oh32); err != nil {
return nil, err return nil, err
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment