From b6463d59e7c52dd4493796ff1cbd10b5e25caaca Mon Sep 17 00:00:00 2001 From: Scott Myron Date: Fri, 2 Jan 2026 20:47:59 -0600 Subject: [PATCH] [ruby/json] Directly write to the output buffer when converting UTF32 to UTF8. https://github.com/ruby/json/commit/a51317c949 --- ext/json/parser/parser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c index 0ac16918f8..f1ea1b6abb 100644 --- a/ext/json/parser/parser.c +++ b/ext/json/parser/parser.c @@ -739,9 +739,7 @@ NOINLINE(static) VALUE json_string_unescape(JSON_ParserState *state, JSON_Parser } } - char buf[4]; - int unescape_len = convert_UTF32_to_UTF8(buf, ch); - MEMCPY(buffer, buf, char, unescape_len); + int unescape_len = convert_UTF32_to_UTF8(buffer, ch); buffer += unescape_len; p = ++pe; break;