This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix utf8_to_uvchr for non-core calls
authorKarl Williamson <khw@cpan.org>
Fri, 4 Mar 2022 21:25:21 +0000 (14:25 -0700)
committerKarl Williamson <khw@cpan.org>
Sun, 6 Mar 2022 04:07:52 +0000 (21:07 -0700)
Commit a460925186154b270b7a647a4f30b2f01fd97c4b broke calling this and
related functions from outside of core Perl, but only when the input is
empty (which is an error anyway, so was not caught except for deliberate
API edge case tests in Devel::PPPort).

inline.h

index c2123ad..c5f0ee6 100644 (file)
--- a/inline.h
+++ b/inline.h
@@ -2468,7 +2468,12 @@ Perl_utf8n_to_uvchr_msgs(const U8 *s,
      * cases. */
 
     /* No calls from core pass in an empty string; non-core need a check */
-    PERL_NON_CORE_CHECK_EMPTY(s, send);
+#ifdef PERL_CORE
+    assert(curlen > 0);
+#else
+    if (curlen == 0) return _utf8n_to_uvchr_msgs_helper(s0, 0, retlen,
+                                                        flags, errors, msgs);
+#endif
 
     type = PL_strict_utf8_dfa_tab[*s];