In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/fdb72414df25d6fe008ccc6053e263c671fa93b0?hp=b1d21918e268271d791ff30e83cf9c4f8c351707>
- Log ----------------------------------------------------------------- commit fdb72414df25d6fe008ccc6053e263c671fa93b0 Author: Karl Williamson <k...@cpan.org> Date: Mon Jun 11 12:58:25 2018 -0600 utf8.h: Add assert for utf8n_to_uvchr_buf() The Perl_utf8n_to_uvchr_buf() version of this function has an assert; this adds it as well to the macro that bypasses the function. commit ff58ca57f8442a7e2e74ab4a79a9e542f9a180e7 Author: Karl Williamson <k...@cpan.org> Date: Mon Jun 11 13:26:24 2018 -0600 perl.h: Add parens around macro arguments Arguments used within macros need to be parenthesized in case they are called with an expression. This commit changes _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG() to do that. commit e1a2878a55b1a7f11f19b384c4ea5235c29866b2 Author: Karl Williamson <k...@cpan.org> Date: Mon Jun 11 13:28:53 2018 -0600 regexec.c: Call macro with correct args. The second argument to this macro is a pointer to the end, as opposed to a length. ----------------------------------------------------------------------- Summary of changes: perl.h | 2 +- regexec.c | 2 +- utf8.h | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/perl.h b/perl.h index 6f04c6facd..3e1f6cd571 100644 --- a/perl.h +++ b/perl.h @@ -5632,7 +5632,7 @@ typedef struct am_table_short AMTS; # define _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(s, send) \ STMT_START { /* Check if to warn before doing the conversion work */\ if (! PL_in_utf8_CTYPE_locale && ckWARN(WARN_LOCALE)) { \ - UV cp = utf8_to_uvchr_buf((U8 *) s, (U8 *) send, NULL); \ + UV cp = utf8_to_uvchr_buf((U8 *) (s), (U8 *) (send), NULL); \ Perl_warner(aTHX_ packWARN(WARN_LOCALE), \ "Wide character (U+%" UVXf ") in %s", \ (cp == 0) \ diff --git a/regexec.c b/regexec.c index 7ed8f4fabc..ba52ae97c7 100644 --- a/regexec.c +++ b/regexec.c @@ -1808,7 +1808,7 @@ STMT_START { case trie_flu8: \ _CHECK_AND_WARN_PROBLEMATIC_LOCALE; \ if (UTF8_IS_ABOVE_LATIN1(*uc)) { \ - _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(uc, uc_end - uc); \ + _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(uc, uc_end); \ } \ goto do_trie_utf8_fold; \ case trie_utf8_exactfa_fold: \ diff --git a/utf8.h b/utf8.h index e0fc6b6141..87b26d1e05 100644 --- a/utf8.h +++ b/utf8.h @@ -74,8 +74,9 @@ the string is invariant. #define uvchr_to_utf8_flags_msgs(d,uv,flags,msgs) \ uvoffuni_to_utf8_flags_msgs(d,NATIVE_TO_UNI(uv),flags, msgs) #define utf8_to_uvchr_buf(s, e, lenp) \ - utf8n_to_uvchr(s, (U8*)(e) - (U8*)(s), lenp, \ - ckWARN_d(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY) + (__ASSERT_((U8*) (e) > (U8*) (s)) \ + utf8n_to_uvchr(s, (U8*)(e) - (U8*)(s), lenp, \ + ckWARN_d(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY)) #define utf8n_to_uvchr(s, len, lenp, flags) \ utf8n_to_uvchr_error(s, len, lenp, flags, 0) #define utf8n_to_uvchr_error(s, len, lenp, flags, errors) \ -- Perl5 Master Repository