summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-06-11 12:58:25 -0600
committerKarl Williamson <khw@cpan.org>2018-07-01 18:33:49 -0600
commitfdb72414df25d6fe008ccc6053e263c671fa93b0 (patch)
treed5e10921208a5527c4dda9d329d9404732d8ea89 /utf8.h
parentff58ca57f8442a7e2e74ab4a79a9e542f9a180e7 (diff)
downloadperl-fdb72414df25d6fe008ccc6053e263c671fa93b0.tar.gz
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.
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h5
1 files changed, 3 insertions, 2 deletions
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) \