Skip to content

Commit

Permalink
utf8n_to_uvchr_msgs: Widen declaration to U16.
Browse files Browse the repository at this point in the history
Testing on an EBCDIC box showed that this was too narrow.
  • Loading branch information
khwilliamson committed Oct 31, 2024
1 parent 1067e02 commit 4acc9fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4acc9fb

Please sign in to comment.