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

Fixing property parsing issue on Rust 1.78+ #129

Merged
merged 6 commits into from
Jun 4, 2024
Merged

Conversation

matterpreter
Copy link
Contributor

Rust introduced a change to std::slice::from_raw_parts() that breaks this crate. The panics caused by this change occur when parsing properties with the most prevalent being those of type TDH_INTYPE_UNICODESTRING in my testing.

To resolve this issue, this MR adds checks to validate the assertions made in std::slice::from_raw_parts() . These are:

  1. the pointer must not be NULL
  2. the pointer must be aligned
  3. the total size of the slice not to exceed isize::MAX

I focused on resolving the wide string conversion, but I also added a proposed fixed for arrays though I was unable to validate it.

Reference:

Copy link
Owner

@n4r1b n4r1b left a comment

Choose a reason for hiding this comment

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

lgtm! Thanks @matterpreter

@n4r1b n4r1b merged commit 73137e7 into n4r1b:master Jun 4, 2024
@PaulDance PaulDance mentioned this pull request Jun 18, 2024
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.

2 participants