-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SafeInteropWrapper crashes with 'cgImage.width' #80948
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
Conversation
@swift-ci test |
a8cab09
to
1c9cfa1
Compare
@swift-ci smoke test |
lib/ClangImporter/ImportDecl.cpp
Outdated
@@ -9159,6 +9159,8 @@ void ClangImporter::Implementation::swiftify(FuncDecl *MappedDecl) { | |||
returnHasLifetimeInfo = true; | |||
} | |||
for (auto [index, clangParam] : llvm::enumerate(ClangDecl->parameters())) { | |||
if (index >= MappedDecl->getParameters()->size()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this protects against the crash, I don't think we want to apply _SwiftifyImport
in any case where there's a parameter mismatch, since they could all be off by 1. I would suggest changing it to an early exit before the loop:
if (ClangDecl->parameters()->size() != MappedDecl->getParameters()->size())
return;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
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
1c9cfa1
to
af8579f
Compare
@swift-ci smoke test |
@swift-ci smoke test |
8f706b4
to
66e0486
Compare
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci smoke test |
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