mandiant / mandiant/GoReSym

symtab assigned on error instead of successful parse?

Open Beginner friendly
#98 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
1.1k
Forks
110
Avg merge
3d 2h
Merged PRs (30d)
1

Description

Hi,

I'm a software engineer currently working on Go binary analysis, and while reviewing the code I noticed what might be a logic issue in objfile/pe.go around line 180.

send_tab := func(candidate *PclntabCandidate) {
if symtab_err != nil {
candidate.Symtab = symtab
ch_tab <- *candidate
}
ch_tab <- *candidate
}

From my understanding, symtab should be assigned to candidate.Symtab when parsing succeeds (symtab_err == nil), not when an error occurs.

Currently, the code assigns the parsed symtab only when symtab_err != nil, which seems unexpected. As a result, when parsing succeeds, candidate.Symtab is never populated.

Would the following logic be more appropriate?

if symtab_err == nil {
candidate.Symtab = symtab
}

Additionally, it looks like ch_tab <- *candidate is executed twice when symtab_err != nil, causing the same candidate to be sent twice. Is this intentional?

I may be missing some context, so I wanted to ask before submitting a patch.

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in objfile/pe.go around line 180 and inspect the send_tab closure, including both symtab_err handling and ch_tab sends. Verify the candidate is populated only for a successful parse and is not sent twice on an error; confirm the relevant Go tests or checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
reverse-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.