From 91ec4e45a307d7faf1b76d766cdf95b610f2d6d6 Mon Sep 17 00:00:00 2001 From: Zxilly Date: Mon, 16 Sep 2024 04:33:48 +0800 Subject: [PATCH] fix: seek file before use --- file.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/file.go b/file.go index ef38907..1163a54 100644 --- a/file.go +++ b/file.go @@ -442,7 +442,13 @@ func (f *GoFile) PCLNTab() (*gosym.Table, error) { } func (f *GoFile) findRuntimeTextMachoChainedFixups(pclntabAddr uint64) (uint64, error) { - f2, err := macho2.NewFile(f.fh.getFile()) + of := f.fh.getFile() + _, err := of.Seek(0, io.SeekStart) + if err != nil { + return 0, err + } + + f2, err := macho2.NewFile(of) if err != nil { return 0, err }