Skip to content

Commit 0e84588

Browse files
committed
Modify string even if it didn't expand
String data might be shared, so modify to ensure we have a writable version.
1 parent 3c2ba51 commit 0e84588

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ext/java/org/jruby/ext/stringio/StringIO.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ private void ungetbyteCommon(ThreadContext context, byte[] ungetBytes, int cp, i
15591559
strBytelist = str.getByteList();
15601560
strBytelist.setRealSize(len + rest);
15611561
} else {
1562+
str.modify();
15621563
strBytelist = str.getByteList();
15631564
}
15641565
strBytes = strBytelist.unsafeBytes();

0 commit comments

Comments
 (0)