summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-01-16 23:59:55 +0900
committergit <[email protected]>2024-01-16 15:06:22 +0000
commit6283ae8d369bd2f8a022bb69bc5b742c58529dec ()
treef2ffec9c57672d3a678598fbd0f672ba72bf0bc5
parentfef8ccff11a5f48eef9f11f61ff0baa165acfaff (diff)
[ruby/stringio] Update the coderange after overwrite
Fix https://bugs.ruby-lang.org/issues/20185 https://.com/ruby/stringio/commit/8230552a46
-rw-r--r--ext/stringio/stringio.c6
-rw-r--r--test/stringio/test_stringio.rb10
2 files changed, 16 insertions, 0 deletions
@@ -1464,8 +1464,14 @@ strio_write(VALUE self, VALUE str)
}
}
else {
strio_extend(ptr, ptr->pos, len);
memmove(RSTRING_PTR(ptr->string)+ptr->pos, RSTRING_PTR(str), len);
}
RB_GC_GUARD(str);
ptr->pos += len;
@@ -953,6 +953,16 @@ class TestStringIO < Test::Unit::TestCase
$VERBOSE = verbose
end
def assert_string(content, encoding, str, mesg = nil)
assert_equal([content, encoding], [str, str.encoding], mesg)
end