From 4acc9fb8d9883d45c7f3c232e326b4223ffc8949 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 13 Oct 2024 13:15:41 -0600 Subject: [PATCH] utf8n_to_uvchr_msgs: Widen declaration to U16. Testing on an EBCDIC box showed that this was too narrow. --- inline.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inline.h b/inline.h index 54b5b26ae2b4..11e59be414a4 100644 --- a/inline.h +++ b/inline.h @@ -3109,9 +3109,11 @@ Perl_utf8n_to_uvchr_msgs(const U8 * const s0, * * The terminology of the dfa refers to a 'class'. The variable 'type' * would have been named 'class' except that is a reserved word in C++ - * */ + * + * The table can be a U16 on EBCDIC platforms, so 'state' is declared + * as U16; 'type' is likely to never occupy more than 5 bits. */ PERL_UINT_FAST8_T type = PL_strict_utf8_dfa_tab[*s]; - PERL_UINT_FAST8_T state = PL_strict_utf8_dfa_tab[256 + type]; + PERL_UINT_FAST16_T state = PL_strict_utf8_dfa_tab[256 + type]; UV uv = (0xff >> type) & NATIVE_UTF8_TO_I8(*s); while (state > 1 && ++s < send) {