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-3490] String(contentsOfFile:encoding:) crashes when file is inaccessible #4308

Closed
swift-ci opened this issue Dec 26, 2016 · 1 comment
Closed

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-3490
Radar None
Original Reporter emlai (JIRA User)
Type Bug
Status Closed
Resolution Duplicate
Environment

Ubuntu 14.04 + swift-3.0.2-RELEASE-ubuntu14.04 (reproducible with Swift 3.0.1 too)

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

md5: a4ba08e19e134dfdda23ed7c49636284

duplicates:

  • SR-1547 NSData causes segmentation fault

Issue Description:

In my Swift 3.0.2 server app on Heroku (which runs it on Ubuntu 14.04), when I call String(contentsOfFile:encoding🙂 with an inaccessible path (FileManager.default.fileExists returns false for it), the function aborts the program. The following error is shown in heroku logs:

2016-12-26T01:59:01.304535+00:00 heroku[web.1]: Process exited with status 139

There's no error message other than that. On my local machine (macOS) the call properly throws an error for a non-existent file.

@swift-ci
Copy link
Contributor Author

Comment by emlai (JIRA)

String(contentsOfFile:encoding🙂 calls NSData(contentsOfFile:options🙂 internally.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant