Issue #15941 has been updated by luke-gru (Luke Gruber).


Patch lgtm, thanks! In case someone can't replicate the issue because of the invalid UTF-8 string literal, I ran it with miniruby, not ruby.

----------------------------------------
Bug #15941: Issue with String#scrub when given block and receiver is modified in block
https://bugs.ruby-lang.org/issues/15941#change-78720

* Author: luke-gru (Luke Gruber)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
This should cause a segmentation fault:

```ruby
s = "abc\u3042\xE3\x80"
loop do
    s.scrub{|bytes| s << "more content"; "?" }
end
```

Not something that should happen, but I thought it might cause undesired behavior.
Thank you for your time :)

---Files--------------------------------
scrub-modify-check.patch (3.82 KB)


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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>