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-5557] Foundation crashes instead of throwing in case of invalid regular expression pattern #3824

Closed
ankitspd opened this issue Jul 26, 2017 · 2 comments

Comments

@ankitspd
Copy link
Member

Previous ID SR-5557
Radar None
Original Reporter @aciidb0mb3r
Type Bug
Status Resolved
Resolution Done
Environment

swift-DEVELOPMENT-SNAPSHOT-2017-07-24-a-ubuntu16.04

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

md5: 8047fdac31c3741ebde01b4b9b8757c1

is duplicated by:

  • SR-5477 NSRegularExpression crashes when created with invalid pattern on Linux

Issue Description:

import Foundation

do {
    let _ = try NSRegularExpression(pattern: "(", options: [])
} catch {
    print(error)
}

macOS:

$ swift main.swift
Error Domain=NSCocoaErrorDomain Code=2048 "The value “(” is invalid." UserInfo={NSInvalidValue=(}

Linux:

$ swift main.swift
swift main.swift
0  swift            0x0000000003ae8ee8
1  swift            0x0000000003ae9626
2  libpthread.so.0  0x00007f5be1c6d390
3  libFoundation.so 0x00007f5bda4b3350 __HALT + 0
4  libFoundation.so 0x00007f5bda4c5495
5  libFoundation.so 0x00007f5bda4d011e CFDictionaryCreate + 270
6  libFoundation.so 0x00007f5bda60436b _CFRegularExpressionCreate + 427
7  libFoundation.so 0x00007f5bda7ec86b
8  libFoundation.so 0x00007f5bda7e9a70 _T010Foundation19NSRegularExpressionCACSS7pattern_AC7OptionsV7optionstKcfC + 96
9  libFoundation.so 0x00007f5be1fe60d0 _T010Foundation19NSRegularExpressionCACSS7pattern_AC7OptionsV7optionstKcfC + 125814464
10 swift            0x0000000000f2df8f
11 swift            0x0000000000f32132
12 swift            0x00000000004c4966
13 swift            0x00000000004b01e9
14 swift            0x00000000004abf61
15 swift            0x0000000000465594
16 libc.so.6        0x00007f5be017e830 __libc_start_main + 240
17 swift            0x0000000000462e69
Stack dump:
0.  Program arguments: /usr/bin/swift -frontend -interpret main.swift -disable-objc-interop -color-diagnostics -module-name main
Illegal instruction
@jpsim
Copy link
Contributor

jpsim commented Jul 31, 2017

Duplicate of SR-5477: https://bugs.swift.org/browse/SR-5477

@spevans
Copy link
Collaborator

spevans commented Aug 9, 2017

Potential fix: #1164

@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

3 participants