fix(pe): represent ordinal imports with name: None - #530
Closed
wyf027 wants to merge 2 commits into
Closed
Conversation
Use Option for PE Import names instead of synthesizing "ORDINAL N" placeholders. Ordinal imports now expose None for name and keep the ordinal field as the source of truth. Fixes #38 Co-authored-by: Cursor <cursoragent@cursor.com>
Owner
|
I guess this makes sense, I'd probably design it this way if I did it right now, but could you give some motivation for this PR? The ordinal is always "authoritative" afaik. Is there some usecase where you want to know if it truly didn't have an ordinal name (e.g., it was None)? |
Contributor
|
@m4b this is BC right. so if we do this in future major bump, I believe we could do some major refactor for import table parser along with this? |
Owner
|
@kkent030315 yes, what other changes did you have in mind? |
Contributor
Author
|
Resolved the rustfmt CI failure in commit bef45f7 by applying the formatter to src/pe/import.rs. Local verification: cargo fmt -- --check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #38 by changing PE
Import.namefromCow<str>toOption<Cow<str>>.Ordinal-only imports no longer synthesize placeholder strings like
"ORDINAL 51398". Instead,nameisNoneand theordinalfield remains authoritative.Breaking change
This is an API change for consumers that matched on the
"ORDINAL {n}"string convention. They should now checkname.is_none()and useordinal.Test plan
cargo test -p goblin --lib pe::import::tests