Skip to content

[SR-10458] EXC_BAD_ACCESS when calling URL(string:) API #3446

Open
@swift-ci

Description

@swift-ci
Previous ID SR-10458
Radar None
Original Reporter leonid.kokhnovych (JIRA User)
Type Bug

Attachment: Download

Environment

Version 10.2 (10E125)

Swift 5.0

Mac OS 10.14.4

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

md5: da3eaf8c5f11e2f7f8f57f9ede691808

Issue Description:

Hi everyone! I have an issue that I'm not able to constantly reproduce, but want to share in case someone has a clue what might be going on.

I'm getting the following crash error

EXC_BAD_ACCESS (code=1, address=0x0)

when running the code similar to something below (can't share the original code due to software license):

internal enum Server {
    case ServerFromList(path: String)


    var url: URL? {
        switch self {
        case .ServerFromList(let path):
            return URL(string: path)
        }
    }
}


let server = Server.ServerFromList(path: "https://www.forticloud.com")
print("\(server.url)")
print("test")

The stack trace is:

po Thread.callStackSymbols46 elements
  - 0 : "0   ???                                 0x00000001468a3a08 0x0 + 5478431240"
  - 1 : "1   ???                                 0x00000001468a3aab 0x0 + 5478431403"
  - 2 : "2   FortiExplorer                       0x00000001064c42f0 main + 0"
  - 3 : "3   libswiftCore.dylib                  0x00000001145926f9 $sSS23_bridgeToObjectiveCImplyXlyF + 9"
  - 4 : "4   libswiftFoundation.dylib            0x0000000114cbd45a $s10Foundation3URLV6stringACSgSSh_tcfC + 90"
  - 5 : "5   FortiExplorerCore                   0x0000000112bbc305 $s17FortiExplorerCore0A12CloudRequestC6ServerO3url10Foundation3URLVSgvg + 901"
...

The Xcode stack trace looks like:

![](Screen Shot 2019-04-11 at 12.46.21 PM.png)

A few more details about the input path:

(lldb) po type(of: path)
Swift.String


(lldb) po dump(path)
- "https://www.forticloud.com"
"https://www.forticloud.com"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions