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-9299] "\r\n".replacingOccurrences(of: "\n", with: "_") crashes the program #3585

Closed
weissi opened this issue Nov 19, 2018 · 1 comment
Closed

Comments

@weissi
Copy link
Member

weissi commented Nov 19, 2018

Previous ID SR-9299
Radar None
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, RunTimeCrash
Assignee None
Priority Medium

md5: c1886af3b7e1c1643b38deb01ae39c4c

duplicates:

  • SR-8689 Ubuntu 18.04: Crash on carriage return and linefeed

Issue Description:

On Linux with Swift 4.2.1 this crashes the program:

"\r\n".replacingOccurrences(of: "\n", with: "_")

repro:

root@a8e5cf6b26e5:/# swift
Welcome to Swift version 4.2.1 (swift-4.2.1-RELEASE). Type :help for assistance.
  1> import Foundation
  2> "\r\n".replacingOccurrences(of: "\n", with: "_")
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
Process 27 stopped
* thread #​1, name = 'repl_swift', stop reason = signal SIGILL: illegal instruction operand
    frame #&#8203;0: 0x00007ffff3dd388e libFoundation.so`function signature specialization <Arg[0] = Exploded> of Foundation.NSMutableString.replaceCharacters(in: Foundation._NSRange, with: Swift.String) -> () + 1054
libFoundation.so`function signature specialization <Arg[0] = Exploded> of Foundation.NSMutableString.replaceCharacters(in: Foundation._NSRange, with: Swift.String) -> ():
->  0x7ffff3dd388e <+1054>: ud2    
    0x7ffff3dd3890 <+1056>: ud2    
    0x7ffff3dd3892 <+1058>: ud2    
    0x7ffff3dd3894 <+1060>: ud2    
Target 0: (repl_swift) stopped.
  3>  
@spevans
Copy link
Collaborator

spevans commented Nov 20, 2018

This was fixed in https://bugs.swift.org/browse/SR-8689

$ swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM cbe8d5e28f, Clang 3452631569, Swift 739169dc77).
Type :help for assistance.
  1> import Foundation
  2> "\r\n".replacingOccurrences(of: "\n", with: "_")
$R0: String = "\r_"
  3>  

@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

2 participants