Skip to content

StringIO.set_encoding may change shared ByteList encoding#1699

Merged
enebo merged 1 commit intojruby:masterfrom
intentmedia:stringio_modify_before_set_encoding
May 21, 2014
Merged

StringIO.set_encoding may change shared ByteList encoding#1699
enebo merged 1 commit intojruby:masterfrom
intentmedia:stringio_modify_before_set_encoding

Conversation

@orikremer
Copy link
Contributor

When creating a StringIO instance with no arguments, ptr.string references the shared EMPTY_BYTELISTS instance for that encoding.

It is possible to then call set_encoding to change the encoding on the shared instance.

This fix is to duplicate the value before changing the encoding.

enebo added a commit that referenced this pull request May 21, 2014
…encoding

StringIO.set_encoding may change shared ByteList encoding
@enebo enebo merged commit 9228157 into jruby:master May 21, 2014
@enebo enebo added this to the JRuby 1.7.13 milestone May 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants