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

Fix use-after-free in Dataset::close #420

Merged
merged 2 commits into from
Aug 17, 2023

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Jul 5, 2023

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

@lnicola lnicola changed the title Fix use-after-free in Dataset::close Fix use-after-free in Dataset::close Jul 5, 2023
@@ -174,6 +174,7 @@ impl GeoTransformEx for GeoTransform {
#[derive(Debug)]
pub struct Dataset {
c_dataset: GDALDatasetH,
closed: bool,
Copy link
Member Author

Choose a reason for hiding this comment

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

We could also have a wrapper around c_dataset and use ManuallyDrop on that instead.

Copy link
Member

Choose a reason for hiding this comment

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

ManuallyDrop sounds nice

Copy link
Member Author

Choose a reason for hiding this comment

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

I switched to ManuallyDrop in 2e4b75e, but I'm not sure it's much better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Scratch that, it doesn't really work, because the inner type's drop still runs, and we can't get the return value of GDALClose out of there. I'll revert to the previous version.

src/dataset.rs Show resolved Hide resolved
@lnicola lnicola force-pushed the fix-dataset-close branch 4 times, most recently from e181682 to 59d7f6e Compare August 2, 2023 17:16
@lnicola
Copy link
Member Author

lnicola commented Aug 4, 2023

r? @jdroenner

@jdroenner jdroenner merged commit dd1c5c1 into georust:master Aug 17, 2023
8 checks passed
@jdroenner
Copy link
Member

sorry i forgot to merge this. Should we create a new release tomorrow?

@lnicola lnicola deleted the fix-dataset-close branch August 17, 2023 18:49
@lnicola
Copy link
Member Author

lnicola commented Aug 17, 2023

I might not be around tomorrow, but please do, if you can. I'd also yank the current version.

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