diff options
| author | nagachika <nagachika@ruby-lang.org> | 2024-07-15 10:41:21 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-07-15 10:41:21 +0900 |
| commit | 715633ba6e982dc5404abeafc5246c31af92ac10 (patch) | |
| tree | cfd2efe9f7ae841c272ac300a1f3dd84aa4747c7 | |
| parent | 90f4c5dc73af3fff76500dd4223792a6d9f58636 (diff) | |
follow-up for a54c717c7a74b91a3cdf20742c355e3ea42052d1.
| -rw-r--r-- | string.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1938,7 +1938,11 @@ rb_str_init(int argc, VALUE *argv, VALUE str) /* make noembed always */ const size_t size = (size_t)capa + termlen; const char *const old_ptr = RSTRING_PTR(str); +#if USE_RVARGC const size_t osize = RSTRING_LEN(str) + TERM_LEN(str); +#else + const size_t osize = RSTRING_EMBED_LEN_MAX + 1; +#endif char *new_ptr = ALLOC_N(char, size); if (STR_EMBED_P(str)) RUBY_ASSERT((long)osize <= str_embed_capa(str)); memcpy(new_ptr, old_ptr, osize < size ? osize : size); |
