Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid failing if an exports trie symbol name cannot be decoded as UTF-8 #25

Open
PaulDance opened this issue Nov 2, 2023 · 0 comments

Comments

@PaulDance
Copy link

Whenever one calls ExportsTrie::parse on a data bytes slice containing a trie with non-UTF8 strings, for example if UTF-16 is encountered, Err(Error::FromUTF8Error(...)) is returned. This makes the whole parsing fail while as far as I known it is not strictly-speaking a parsing error as nothing requires trie strings to only be valid UTF-8. At least, I did observe in the wild some macho files with UTF-16 trie strings that do run under macOS.

It would be nice if there was a way to get symbols with the name left as raw bytes instead. This way, the user would be able to decide what to do with the bytes instead of having the parsing decide that for them.

This could potentially be achieved by adding some kind of new lower-level API somewhere that would be orthogonal to the already-existing one. From what I've seen, only the calls to <Cursor as CursorExt>::read_cstr would need to be changed. This could be a lead to follow in order to avoid duplication between the two APIs as much as possible.

@PaulDance PaulDance changed the title Avoid failing if an exports trie symbol name connot be decoded as UTF-8 Avoid failing if an exports trie symbol name cannot be decoded as UTF-8 Nov 2, 2023
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

No branches or pull requests

1 participant