Issue #11387 has been updated by Usaku NAKAMURA.

Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE

ruby_2_1 r51600 merged revision(s) 51344.

----------------------------------------
Bug #11387: String#force_encoding と String#reverse の後にSEGV
https://bugs.ruby-lang.org/issues/11387#change-53814

* Author: Tatsuya Otsuka
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-07-22 trunk 51342) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE
----------------------------------------
以下のコードでSEGVします。

```ruby
broken_str = "abcd\xf0"
broken_str.force_encoding("utf-8").reverse
p broken_str.reverse
```

また、以下のコードでは `String#split` で `ArgumentError (invalid byte sequence in UTF-8)` が
発生することが期待されますが、実際は例外が発生しません。

```ruby
broken_str = "abcd\xf0"
broken_str.force_encoding("utf-8").reverse
"".split(broken_str)
```

---Files--------------------------------
stdout-and-stderr.txt (3.97 KB)


-- 
https://bugs.ruby-lang.org/