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

A bunch of improvements to elf::extract_from_slice #91

Open
3 of 5 tasks
hawkw opened this issue Mar 13, 2017 · 1 comment
Open
3 of 5 tasks

A bunch of improvements to elf::extract_from_slice #91

hawkw opened this issue Mar 13, 2017 · 1 comment
Assignees
Labels
area/elf Area: this issue describes ELF parsing and loading. from TODO kind/feature Kind: this issue is a feature. kind/refactor Kind: this issue describes refactoring or code quality improvement.

Comments

@hawkw
Copy link
Member

hawkw commented Mar 13, 2017

As of 014adb9, there are a lot of TODOs on this function, so it probably deserves its own issue:

/// TODO: rewrite this as a `TryFrom` implementation (see issue #85)
//          - eliza, 03/09/2017
///       wait, possibly we should NOT do that. actually we should
///       almost certainly not do that. since this function is unsafe,
///       but `TryFrom` is not, and because this would be WAY generic.
//          - eliza, 03/09/2017
/// TODO: is this general enough to move into util?
//          - eliza, 03/09/2017
/// TODO: should this be refactored to return a `Result`?
//          - eliza, 03/13/2017
/// TODO: can we ensure that the lifetime of the returned slice is the same
///       as the lifetime of the input byte slice, rather than inferred by
///       [`slice::from_raw_parts`]?
//          - eliza, 03/13/2017
/// TODO: assert that `offset` is aligned on a `T`-sized boundary
//          - eliza, 03/13/2017
/// TODO: do we want to assert that `offset` is less than the length of `data`
///       separately from asserting that the slice is long enough, so that
///       we can panic with different messages?
//          - eliza, 03/13/2017
///
  • ensure that the lifetime of the returned slice is the same as the lifetime of the input slice
  • assert offset is aligned on a T-sized boundary
  • assert offset is a valid offset into data
  • consider refactoring to return Result
  • consider moving to util crate
@hawkw hawkw added area/elf Area: this issue describes ELF parsing and loading. kind/feature Kind: this issue is a feature. from TODO labels Mar 13, 2017
@hawkw hawkw self-assigned this Mar 13, 2017
@hawkw hawkw added the kind/refactor Kind: this issue describes refactoring or code quality improvement. label Mar 13, 2017
@hawkw
Copy link
Member Author

hawkw commented Mar 15, 2017

Returns Result as of 5e359b0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/elf Area: this issue describes ELF parsing and loading. from TODO kind/feature Kind: this issue is a feature. kind/refactor Kind: this issue describes refactoring or code quality improvement.
Projects
None yet
Development

No branches or pull requests

1 participant