In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/edc2c47a7af2b67f9541072b69a97b21f56cdcd4?hp=933f1527ef5cdf83dd6c18ffb5dd61bf54a975ee>

- Log -----------------------------------------------------------------
commit edc2c47a7af2b67f9541072b69a97b21f56cdcd4
Author: Karl Williamson <k...@cpan.org>
Date:   Mon Sep 19 15:37:52 2016 -0600

    utf8.c: Fix bug in new _is_utf8_char_helper() function
    
    This bug was exposed by the tests that I'm still developing
-----------------------------------------------------------------------

Summary of changes:
 embed.fnc | 2 +-
 proto.h   | 2 +-
 utf8.c    | 7 ++++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/embed.fnc b/embed.fnc
index 983c3ac..2954eda 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -682,7 +682,7 @@ ApR |I32    |is_lvalue_sub
 : Used in cop.h
 XopR   |I32    |was_lvalue_sub
 #ifndef PERL_NO_INLINE_FUNCTIONS
-ApMRnP |STRLEN |_is_utf8_char_helper|NN const U8 * const s|NN const U8 * const 
e|const U32 flags
+ApMRnP |STRLEN |_is_utf8_char_helper|NN const U8 * const s|NN const U8 * 
e|const U32 flags
 #endif
 ADMpPR |U32    |to_uni_upper_lc|U32 c
 ADMpPR |U32    |to_uni_title_lc|U32 c
diff --git a/proto.h b/proto.h
index f57fb35..7c2a821 100644
--- a/proto.h
+++ b/proto.h
@@ -3813,7 +3813,7 @@ STATIC SV *       S_incpush_if_exists(pTHX_ AV *const av, 
SV *dir, SV *const stem);
 #  endif
 #endif
 #if !defined(PERL_NO_INLINE_FUNCTIONS)
-PERL_CALLCONV STRLEN   Perl__is_utf8_char_helper(const U8 * const s, const U8 
* const e, const U32 flags)
+PERL_CALLCONV STRLEN   Perl__is_utf8_char_helper(const U8 * const s, const U8 
* e, const U32 flags)
                        __attribute__warn_unused_result__
                        __attribute__pure__;
 #define PERL_ARGS_ASSERT__IS_UTF8_CHAR_HELPER  \
diff --git a/utf8.c b/utf8.c
index ec345ea..7f8df9d 100644
--- a/utf8.c
+++ b/utf8.c
@@ -424,7 +424,7 @@ S_is_utf8_cp_above_31_bits(const U8 * const s, const U8 * 
const e)
 }
 
 STRLEN
-Perl__is_utf8_char_helper(const U8 * const s, const U8 * const e, const U32 
flags)
+Perl__is_utf8_char_helper(const U8 * const s, const U8 * e, const U32 flags)
 {
     STRLEN len;
     const U8 *x, *y;
@@ -472,6 +472,11 @@ Perl__is_utf8_char_helper(const U8 * const s, const U8 * 
const e, const U32 flag
         return 0;
     }
 
+    /* Examine a maximum of a single whole code point */
+    if (e - s > UTF8SKIP(s)) {
+        e = s + UTF8SKIP(s);
+    }
+
     len = e - s;
 
     if (flags && isUTF8_POSSIBLY_PROBLEMATIC(*s)) {

--
Perl5 Master Repository

Reply via email to