Skip to content

SafeInteropWrapper crashes with 'cgImage.width' #81075

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

Merged
merged 4 commits into from
Apr 30, 2025

Conversation

rapidsna
Copy link
Contributor

  • Explanation: cgImage.width calls the C function, CGImageGetWidth(CGImageRef). Swift representation creates it as a getter function, without treating "self" as an additional parameter, and therefore the parameter numbers mismatch between Clang and Swift. This caused the swiftly function to crash.

  • Scope: The code affected by this change is under an experimental flag, SafeInteropWrappers. Thus, this won't break any existing code.

  • Issues: rdar://149691207

  • Original PRs: SafeInteropWrapper crashes with 'cgImage.width' #80948

  • Risk: The risk is very low. This is an experimental feature SafeInteropWrapper, which isn't used yet.

  • Testing: Verified with the regression test that triggered the crash and local testing.

  • Reviewers: @hnrklssn @Xazax-hun

cgImage.width calls the C function, CGImageGetWidth(CGImageRef).
Swift representation and Clang representation of this function
seem to have a parameter number mismatch, causing swiftify function
to crash.

rdar://149691207
(cherry picked from commit af8579f)
@rapidsna rapidsna requested a review from a team as a code owner April 24, 2025 16:56
@rapidsna
Copy link
Contributor Author

@swift-ci test

@rapidsna
Copy link
Contributor Author

CI is blocked on a clang crash:
clang++: error: unable to execute command: Segmentation fault: 11
clang++: error: linker command failed due to signal (use -v to see invocation)

@rapidsna
Copy link
Contributor Author

@swift-ci test

@rapidsna
Copy link
Contributor Author

@swift-ci test macOS

@rapidsna
Copy link
Contributor Author

@swift-ci test

@rapidsna rapidsna enabled auto-merge (squash) April 29, 2025 00:27
@rapidsna rapidsna force-pushed the eng/PR-149691207-release/6.2 branch from 9a5c6ee to a9d184b Compare April 29, 2025 20:00
@rapidsna
Copy link
Contributor Author

@swift-ci test

@rapidsna
Copy link
Contributor Author

@swift-ci test

@rapidsna
Copy link
Contributor Author

@swift-ci test

@rapidsna rapidsna merged commit 203ee39 into release/6.2 Apr 30, 2025
5 checks passed
@rapidsna rapidsna deleted the eng/PR-149691207-release/6.2 branch April 30, 2025 19:25
@rapidsna rapidsna changed the title [Swiftify] SafeInteropWrapper crashes with 'cgImage.width' SafeInteropWrapper crashes with 'cgImage.width' May 8, 2025
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.

3 participants