Permalink
Browse files

Unshare string when modified

  • Loading branch information...
1 parent 9653426 commit 6b862e2abb7566c20bb02943047fbd6414ef4da8 @dbussink dbussink committed Dec 28, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 vm/builtin/string.cpp
View
@@ -980,7 +980,9 @@ namespace rubinius {
}
if(lim > 0 && byte_size() > lim) {
+ unshare(state);
num_bytes(state, Fixnum::from(lim));
+ num_chars(state, nil<Fixnum>());
byte_address()[byte_size()] = 0;
}
return num_bytes();

0 comments on commit 6b862e2

Please sign in to comment.