Skip to content

Commit 1b70e20

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 93b7139 commit 1b70e20

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
@@ -1551,6 +1551,7 @@ private void ungetbyteCommon(ThreadContext context, byte[] ungetBytes, int cp, i
15511551
strBytelist = str.getByteList();
15521552
strBytelist.setRealSize(len + rest);
15531553
} else {
1554+
str.modify();
15541555
strBytelist = str.getByteList();
15551556
}
15561557
strBytes = strBytelist.unsafeBytes();

0 commit comments

Comments
 (0)