34 lines
842 B
Diff
34 lines
842 B
Diff
From 3cf4b7e53c84d91fa819d89d2504be2db90dee11 Mon Sep 17 00:00:00 2001
|
|
From: Pali <pali@cpan.org>
|
|
Date: Fri, 19 Aug 2016 10:58:56 +0200
|
|
Subject: [PATCH] Encode::utf8: Fix count of replacement characters for
|
|
overflowed and overlong UTF-8 sequences
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
---
|
|
Encode.xs | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/Encode.xs b/Encode.xs
|
|
index 1906f0c..49a3846 100644
|
|
--- a/Encode.xs
|
|
+++ b/Encode.xs
|
|
@@ -366,8 +366,10 @@ convert_utf8_multi_seq(U8* s, STRLEN len, STRLEN *rlen)
|
|
|
|
*rlen = s-ptr;
|
|
|
|
- if (overflowed || *rlen > (STRLEN)UNISKIP(uv))
|
|
+ if (overflowed || *rlen > (STRLEN)UNISKIP(uv)) {
|
|
+ *rlen = 1;
|
|
return 0;
|
|
+ }
|
|
|
|
return uv;
|
|
}
|
|
--
|
|
2.7.4
|
|
|