Akihiro Sagawa : webservices: Add support for decoding supplementary characters' references.
Alexandre Julliard
julliard at winehq.org
Mon Oct 10 15:09:44 CDT 2016
Module: wine
Branch: master
Commit: b98293e405eda13a67cae6da654d9774c90f3650
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b98293e405eda13a67cae6da654d9774c90f3650
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Mon Oct 10 22:53:15 2016 +0900
webservices: Add support for decoding supplementary characters' references.
Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/reader.c | 3 ++-
dlls/webservices/tests/reader.c | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index de92603..a6f5d6b 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -1190,6 +1190,7 @@ static int codepoint_to_utf8( int cp, unsigned char *dst )
dst[0] = 0xe0 | cp;
return 3;
}
+ if (cp >= 0x110000) return -1;
dst[3] = 0x80 | (cp & 0x3f);
cp >>= 6;
dst[2] = 0x80 | (cp & 0x3f);
@@ -1259,7 +1260,7 @@ static HRESULT decode_text( const unsigned char *str, ULONG len, unsigned char *
if (!len) return WS_E_INVALID_FORMAT;
p -= nb_digits = start - len;
- if (!nb_digits || nb_digits > 5 || p[nb_digits] != ';') return WS_E_INVALID_FORMAT;
+ if (!nb_digits || nb_digits > 6 || p[nb_digits] != ';') return WS_E_INVALID_FORMAT;
for (i = 0; i < nb_digits; i++)
{
cp *= 16;
diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c
index f0fe729..a020c01 100644
--- a/dlls/webservices/tests/reader.c
+++ b/dlls/webservices/tests/reader.c
@@ -3614,11 +3614,16 @@ static void test_entities(void)
static const char str29[] = "<t></t>";
static const char str30[] = "<t>A</t>";
static const char str31[] = "<t>ア</t>";
+ static const char str32[] = "<t></t>";
+ static const char str33[] = "<t>�</t>";
+ static const char str34[] = "<t></t>";
+ static const char str35[] = "<t></t>";
static const char res4[] = {0xea, 0xaa, 0xaa, 0x00};
static const char res5[] = {0xf2, 0xaa, 0xaa, 0xaa, 0x00};
static const char res21[] = {0xed, 0x9f, 0xbf, 0x00};
static const char res24[] = {0xee, 0x80, 0x80, 0x00};
static const char res31[] = {0xef, 0xbd, 0xb1, 0x00};
+ static const char res32[] = {0xf4, 0x8f, 0xbf, 0xbf, 0x00};
static const struct
{
const char *str;
@@ -3658,6 +3663,10 @@ static void test_entities(void)
{ str29, WS_E_INVALID_FORMAT },
{ str30, S_OK, "A" },
{ str31, S_OK, res31 },
+ { str32, S_OK, res32 },
+ { str33, WS_E_INVALID_FORMAT },
+ { str34, S_OK, res32 },
+ { str35, WS_E_INVALID_FORMAT },
};
HRESULT hr;
WS_XML_READER *reader;
More information about the wine-cvs
mailing list