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

RangeDetails: don't return dangling pointers #121

Merged
merged 2 commits into from
Jan 4, 2024
Merged

Conversation

s1341
Copy link
Contributor

@s1341 s1341 commented Jan 4, 2024

Fixes issue #120

@s1341 s1341 merged commit 89ce25f into main Jan 4, 2024
30 checks passed
@s1341 s1341 deleted the fix_rangedetails branch January 4, 2024 07:07
@s1341 s1341 restored the fix_rangedetails branch January 4, 2024 07:11
} else {
Some(unsafe {
Self {
path: CStr::from_ptr((*file).path).to_str().unwrap(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Will the path variable live long enough/not be freed at some point as well? Maybe a clone() here or even to_string_lossy would be safer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@domenukk To my eyes, the MemoryRange does not need special treatment, as its from_raw dereferences the pointer into a copy of the object. Correct?

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.

None yet

2 participants