coff: fix reading COFF header offset

This commit is contained in:
William Sengir 2022-08-28 03:10:39 -07:00
parent 0f27836c21
commit 3860e664c5
No known key found for this signature in database
GPG Key ID: 83492BF162833F2A

View File

@ -831,7 +831,7 @@ pub const Coff = struct {
var stream = std.io.fixedBufferStream(self.data); var stream = std.io.fixedBufferStream(self.data);
const reader = stream.reader(); const reader = stream.reader();
try stream.seekTo(pe_pointer_offset); try stream.seekTo(pe_pointer_offset);
const coff_header_offset = try reader.readByte(); const coff_header_offset = try reader.readIntLittle(u32);
try stream.seekTo(coff_header_offset); try stream.seekTo(coff_header_offset);
var buf: [4]u8 = undefined; var buf: [4]u8 = undefined;
try reader.readNoEof(&buf); try reader.readNoEof(&buf);