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

[SR-9477] Dynamic-stack-buffer-overflow caused by where clause on protocol #51939

Closed
swift-ci opened this issue Dec 11, 2018 · 2 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-9477
Radar None
Original Reporter Krutsinger (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

iOS 12.1 (16B92), Xcode 10.1 (10B61), Swift 4.2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, RunTimeCrash
Assignee None
Priority Medium

md5: 0c19f6a71b8d8b70e4904137b35aa00f

duplicates:

  • SR-5581 Proper support for protocol 'where' clause with constraints on 'Self'

Issue Description:

Sample project to reproduce the crash is attached or can be downloaded at https://github.com/ksoftllc/DynamicStackBufferOverflow. It will crash on launch.

The following code accesses an instance of a UIViewController using the this protocol interface:

    protocol DrawerView where Self: UIViewController {
        func configureDrawer(containerView: UIView, overlaidView: UIView)
    }

Here is the site of the call:

        let drawerView = vc as DrawerView
        drawerView.configureDrawer(containerView: drawerContainer, overlaidView: overlaidView)

If you remove the where clause from the protocol, the app will not crash and will function as expected:

    protocol DrawerView {
        func configureDrawer(containerView: UIView, overlaidView: UIView)
    }
@belkadan
Copy link
Contributor

cc @slavapestov

@slavapestov
Copy link
Member

The construct you're trying to use (protocol with superclass-constrained Self) was not supported in 4.2, but it's fully implemented on the swift-5.0-branch.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

4 participants