swiftlang / swiftlang/swift-java
Invalidate Java wrapper when we destroy() an underlying swift instance
Open
Nobody has claimed this yet.
enhancement
feature:jextract
good first issue
help wanted
- Dominant language
- Swift
- Stars
- 1.2k
- Forks
- 123
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 16
Description
We should invalidate wrapper types when we destroy the underlying Swift memory.
This is done in SwiftMemoryResourceCleanup.java
We should zero out the pointer or something else, such that we can prevent use-after-free from the Java side reaching into Swift destroyed objects.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SwiftMemoryResourceCleanup.java and trace how destroy() reaches Java wrapper types. Determine where the underlying Swift memory is released and how wrappers are still used afterward; done means destroyed wrappers cannot reach freed Swift objects from Java.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, swift
- Domain
- devtools, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 43/100