[SR-10478] EXC_BAD_ACCESS of NSError via caught error.localizedDescription, when trying to match it to other error type. #52878
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
crash
Bug: A crash, i.e., an abnormal termination of software
run-time crash
Bug → crash: Swift code crashed during execution
Environment
Running on Xcode Version 10.2 (10E125).
Failing on both a Swift 4.2 project and Swift 5.0 Playground.
Compiling with Optimization Level None [-Onone].
Additional Detail from JIRA
md5: 8669e5a47c8541304bb7e62da864518a
duplicates:
Issue Description:
I ran into an unexpected EXC_BAD_ACCESS on an error I catch in my code. The crash happens when accessing
localizedDescription
, but only when I try to compare the error with some other error type before that.There are many ways to code a working alternative, but this crash certainly looked interesting to me. Hope this report is somehow useful.
I reproduced my issue in this nonsensical but enough-to-proof-the-crash sample code:
As I mention above, the crash happens in the execution of
localizedDescription
. But, if I remove the if-statement trying to match the catched error toMyError
it will not crash anymore.I defined
MyError
to be aCustomNSError
because mine was, but making it anError
causes the same issue.While somehow similar to the issue described on SR-7493, I am having this issue running the project on Xcode, Debug config.
The text was updated successfully, but these errors were encountered: