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

Guard slice with null and length checks #107

Merged
merged 1 commit into from
May 24, 2024
Merged

Guard slice with null and length checks #107

merged 1 commit into from
May 24, 2024

Conversation

nickbabcock
Copy link
Owner

@nickbabcock nickbabcock commented May 24, 2024

Tests started to fail with

panic hook error: plugin panicked: (library/core/src/panicking.rs: 156): unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed isize::MAX

It's not clear to me what changed to cause this (a bit of trial and error showed the root cause being a null "children" or "values" in an oconfig_item_t).

This commit fixes the issue by guarding slice creation with null and length checks.

Tests started to fail with

> panic hook error: plugin panicked: (library/core/src/panicking.rs:
156): unsafe precondition(s) violated: slice::from_raw_parts requires
the pointer to be aligned and non-null, and the total size of the slice
not to exceed `isize::MAX`

It's not clear to me what changed to cause this (a bit of trial and
error showed the root cause being a `null` "children" or "values" in an
`oconfig_item_t`).

This commit fixes the issue by guarding slice creation with null and
length checks.
@nickbabcock nickbabcock merged commit 9e29d10 into master May 24, 2024
4 checks passed
@nickbabcock nickbabcock deleted the null-check branch May 24, 2024 11:50
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.

1 participant