From cfd3c35a50ec276850c2baed5d6eed52473db9e1 Mon Sep 17 00:00:00 2001 From: Kaoru0822 Date: Thu, 15 Oct 2026 07:38:33 -0700 Subject: [PATCH] fix(kuna): keep the real lane's wide-string marker independent of layout (#4116) On macOS arm64 the lane's UTF-8 marker ends right before the UTF-16 array, and its last byte plus NUL decode as the UTF-16LE unit 'r'. Kuna therefore reports "rREA wide marker", and the lane, which requires the exact text, failed with "Required string \"REA wide marker\" was not recovered". A leading NUL unit now ends any run the preceding bytes start, so the marker is recovered exactly on any layout. Refs #1957 Co-authored-by: Claude Opus 5.5 --- scripts/verify-real-kuna.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/verify-real-kuna.mjs b/scripts/verify-real-kuna.mjs index 2361c98ac2..289073c9ae 100644 --- a/scripts/verify-real-kuna.mjs +++ b/scripts/verify-real-kuna.mjs @@ -83,8 +83,11 @@ const FIXTURE_SOURCE = String.raw` #include #include static const char rea_kuna_utf8[] __attribute__((used)) = "_φ( °-°)/ REA unicode marker"; +/* The leading NUL unit ends any UTF-16 run that bytes before this array would + start: the UTF-8 marker's last byte and NUL decode as the unit 'r', so on + layouts where it precedes this array Kuna reports "rREA wide marker". */ static const unsigned short rea_kuna_wide[] __attribute__((used)) = { - 'R','E','A',' ','w','i','d','e',' ','m','a','r','k','e','r',0 + 0,'R','E','A',' ','w','i','d','e',' ','m','a','r','k','e','r',0 }; #include __attribute__((noinline)) unsigned rea_checksum(const unsigned char *p, size_t n) {