[libencode-perl] 02/08: Validate continuations in the incremental UTF-X decoder
Anuradha Weeraman
anuradha-guest at moszumanska.debian.org
Sun Nov 9 12:01:32 UTC 2014
This is an automated email from the git hooks/post-receive script.
anuradha-guest pushed a commit to tag 2.64
in repository libencode-perl.
commit 07ee44ae21b6b99d4f05055be472791aa50ac24b
Author: chansen <chansen at cpan.org>
Date: Wed Oct 22 00:31:45 2014 +0200
Validate continuations in the incremental UTF-X decoder
Ensure that the prefix octet is followed by continuation octets in
the case of a partial UTF-X sequence.
---
Encode.xs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Encode.xs b/Encode.xs
index 755d6d9..0af1bab 100644
--- a/Encode.xs
+++ b/Encode.xs
@@ -343,10 +343,14 @@ process_utf8(pTHX_ SV* dst, U8* s, U8* e, SV *check_sv,
if (UTF8_IS_START(*s)) {
U8 skip = UTF8SKIP(s);
if ((s + skip) > e) {
- /* Partial character */
- /* XXX could check that rest of bytes are UTF8_IS_CONTINUATION(ch) */
- if (stop_at_partial || (check & ENCODE_STOP_AT_PARTIAL))
+ if (stop_at_partial || (check & ENCODE_STOP_AT_PARTIAL)) {
+ const U8 *p = s + 1;
+ for (; p < e; p++) {
+ if (!UTF8_IS_CONTINUATION(*p))
+ goto malformed_byte;
+ }
break;
+ }
goto malformed_byte;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libencode-perl.git
More information about the Pkg-perl-cvs-commits
mailing list