From caf876bab3f0ca1eb21b3b6a38f275c3c7e5de09 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 23 Aug 2024 16:18:42 +0200 Subject: [PATCH] buffer: don't use Fast API for utf8 Fast API handles invalid UTF differently than the slow API. Fixes: https://github.com/nodejs/node/issues/54521 --- src/node_buffer.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 2cbcb5461e52d6c..4312c578dc873a9 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -1564,11 +1564,12 @@ void Initialize(Local target, "latin1WriteStatic", SlowWriteString, &fast_write_string); - SetFastMethod(context, - target, - "utf8WriteStatic", - SlowWriteString, - &fast_write_string); + // SetFastMethod(context, + // target, + // "utf8WriteStatic", + // SlowWriteString, + // &fast_write_string); + SetMethod(context, target, "utf8WriteStatic", SlowWriteString); SetMethod(context, target, "getZeroFillToggle", GetZeroFillToggle); }