diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-03-19 15:03:01 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-03-19 18:23:44 -0600 |
commit | ec5f19d09949aac9034bb62ade44ffba8d4d2bb1 (patch) | |
tree | aee587b46e00f843fa393dcc6427dcbf632c1bd9 /proto.h | |
parent | d0460f306d2b79d09a9e5694f9f72c50a2481b83 (diff) | |
download | perl-ec5f19d09949aac9034bb62ade44ffba8d4d2bb1.tar.gz |
utf8.c: Add utf8_to_uvchr_buf() and utf8_to_uvuni_buf()
The existing functions (utf8_to_uvchr and utf8_to_uvuni) have a
deficiency in that they could read beyond the end of the input string if
given malformed input. This commit creates two new functions which
behave as the old ones did, but have an extra parameter each, which
gives the upper limit to the string, so no read beyond it is done.
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -4568,11 +4568,23 @@ PERL_CALLCONV UV Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) #define PERL_ARGS_ASSERT_UTF8_TO_UVCHR \ assert(s) +PERL_CALLCONV UV Perl_utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_UTF8_TO_UVCHR_BUF \ + assert(s); assert(send) + PERL_CALLCONV UV Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_UTF8_TO_UVUNI \ assert(s) +PERL_CALLCONV UV Perl_utf8_to_uvuni_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_UTF8_TO_UVUNI_BUF \ + assert(s); assert(send) + PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_UTF8N_TO_UVUNI \ |