swiftlang / swiftlang/swift-java

Invalidate Java wrapper when we destroy() an underlying swift instance

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.