Skip to content

Conversation

@chf0x
Copy link
Contributor

@chf0x chf0x commented Jul 14, 2025

@m4b I’ve been using Goblin to work with malware, and over time I’ve encountered a number of cases where parsing fails. In the strstab issue, you mentioned that you might be open to adding a permissive mode to address such pain points. I’d like to reopen this pull request with the changes I’ve made over time to enable parsing of broken binaries.

There are still a few places where the permissive flag is missing, for example, in strtab. I’d be happy to add those if you think this is worth merging into the main project.

I also probably would need to update tests.

Thank you!

@chf0x chf0x closed this Jul 14, 2025
@chf0x chf0x changed the title Next Add/Extend ELF/PE permissive parsing mode to better handle packed, broken, or malware samples Aug 15, 2025
@chf0x chf0x reopened this Aug 15, 2025
Copy link
Contributor

@kkent030315 kkent030315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! I reviewed it partly. I'll do more review at the rest of time.

@chf0x
Copy link
Contributor Author

chf0x commented Aug 16, 2025

Thank you for the review! I’ll work on the fixes on Monday

Copy link
Contributor

@kkent030315 kkent030315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the diff look very clean now; With those changes it would be the cleanest I think.

@kkent030315
Copy link
Contributor

@chf0x by the way what IDE are you on? If you're under VSCode or Zed you might install rust-analyzer extension (if you don't have one yet). It looks like you're having slightly different formatting rule so. :)

Copy link
Contributor

@kkent030315 kkent030315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much, the patch looks very clean!

Copy link
Owner

@m4b m4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok the major thing is the non-exhaustive which I realized must be removed to make this backwards compat, moving the (pub(crate)) helper trait into options for now, and some other minor nits, mostly reducing the api surface from pub to pub(crate).

thanks for your patience, this should be the last review :)

@chf0x
Copy link
Contributor Author

chf0x commented Sep 1, 2025

Thank you for the review. I’ll make the changes. I’ve recently started a new job, so my time is a bit limited, but I’ll return to this asap

@m4b
Copy link
Owner

m4b commented Sep 8, 2025

Ok congrats on the new job! I hope we didn't scare you off with too much review, definitely would like to see this landed at some point, it's a great improvement to goblin. Thanks for your time!

…reduce public API, and lazily format error messages
@chf0x
Copy link
Contributor Author

chf0x commented Sep 20, 2025

Hi team, apologies for the delay. It’s been a busy few weeks, but I believe I’ve addressed all the requested changes. Could you please review? Thank you!

Copy link
Contributor

@kkent030315 kkent030315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. With the permissive trait the codebase looks very clean now! (maybe you can fold them down the comments in options.rs?)

Copy link
Owner

@m4b m4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'd prefer the pub(crate) and non_exhaustive to go in with this patch, but if you don't feel like it, i'll wait until tomorrow, and then merge and force push the changes since thy're important before a point release.

regardless thank you so much for your work on this, this is really great stuff! thank you for pulling through to the final stage :)

src/pe/header.rs Outdated
Self::parse_with_opts(bytes, &crate::pe::options::ParseOptions::default())
}

pub fn parse_with_opts(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still pub :)

…RichHeader::parse_with_opts pub(crate), and remove unnecessary comment
@chf0x
Copy link
Contributor Author

chf0x commented Sep 21, 2025

Awesome news, thanks for reviewing @m4b @kkent030315 ! The last requested changes are now in

@m4b m4b merged commit 69dba8b into m4b:master Sep 21, 2025
5 checks passed
@m4b
Copy link
Owner

m4b commented Sep 21, 2025

thanks for getting this across the finish line @chf0x ! great stuff!

@m4b
Copy link
Owner

m4b commented Sep 21, 2025

NB: backwards compatible

@chf0x chf0x deleted the next branch September 21, 2025 19:16
@m4b
Copy link
Owner

m4b commented Oct 6, 2025

NB: non-breaking, in 0.10.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants