From 6f913b95147b79e988026fed604e7e75ee154844 Mon Sep 17 00:00:00 2001 From: rabbitstack Date: Wed, 27 Nov 2024 18:18:57 +0100 Subject: [PATCH] fix(pe): Require sections during CLR parsing The CLR parsing logic relies on the presence of the section headers. Enable section parsing if CLR option is present. --- pkg/pe/parser.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/pe/parser.go b/pkg/pe/parser.go index c9d4a3658..4eaf07126 100644 --- a/pkg/pe/parser.go +++ b/pkg/pe/parser.go @@ -305,6 +305,11 @@ func parse(path string, data []byte, options ...Option) (*PE, error) { p.EntryPoint = format.UintToHex(uint64(oh32.AddressOfEntryPoint)) } + // CLR directory parsing piggybacks on sections + if opts.parseCLR { + opts.parseSections = true + } + // parse section header if opts.parseSections || opts.parseResources { err = pe.ParseSectionHeader()