Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 6c47c372584db5ee2bc6e09b288f55ac8e9bb5f0
      
https://github.com/Perl/perl5/commit/6c47c372584db5ee2bc6e09b288f55ac8e9bb5f0
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-11-26 (Tue, 26 Nov 2024)

  Changed paths:
    M utf8.c

  Log Message:
  -----------
  utf8n_to_uvchr_msgs(): Fix wrong overflow warn category

This function looks for various malformation in the input string that is
being converted from UTF-8 to its equivalen code point ordinal value.
When it finds an issue, it can either raise a warning (if appropriate) or
pass the needed information about the warning back to the caller when
the function parameters say to.  The data for each should be identical,
but prior to this commit, they weren't in one unlikely case.

This happened when the input UTF-8 sequence represents a code point
whose value doesn't fit in the platform's word size.  This is viewed
as a malformation, and, if enabled, a warning using the WARN_UTF8
category is raised.  But if disabled, another way to look at it is that
this is an attempt to use a code point that isn't legal Unicode.  There
is another warnings category for that, WARN_NON_UNICODE.  And, so a warning
is raised if that category is enabled.

Note that WARN_NON_UNICODE is a subcategory of WARN_UTF8, so the only
way to get to this situation is

    no warnings 'utf8'; use warnings 'non_unicode';

(those two statements could be separated by many lines)

Prior to this commit, if the caller asked for the warning information to
be passed to it instead of raising the warnings, WARN_NON_UNICODE never
was returned, making the two modes sometimes inconsistent.

With this commit, WARN_NON_UNICODE is passed to the caller if (and only
if) a warning would otherwise have been generated using it.

This bug was found with tests that will be commited later.



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to