Akihiro Sagawa : webservices: Avoid decoding a nul character reference.

Alexandre Julliard julliard at winehq.org
Mon Oct 10 15:09:44 CDT 2016


Module: wine
Branch: master
Commit: 064edd2d8b3f02b57fd881d40e89cf7ae9c1adba
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=064edd2d8b3f02b57fd881d40e89cf7ae9c1adba

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Mon Oct 10 22:53:12 2016 +0900

webservices: Avoid decoding a nul character reference.

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       | 2 ++
 dlls/webservices/tests/reader.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index 8b9faf2..655288a 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -1166,6 +1166,8 @@ static HRESULT parse_name( const unsigned char *str, unsigned int len,
 
 static int codepoint_to_utf8( int cp, unsigned char *dst )
 {
+    if (!cp)
+        return -1;
     if (cp < 0x80)
     {
         *dst = cp;
diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c
index 06c18b2..76de14a 100644
--- a/dlls/webservices/tests/reader.c
+++ b/dlls/webservices/tests/reader.c
@@ -3610,6 +3610,7 @@ static void test_entities(void)
     static const char str25[] = "<t>&#xfffe;</t>";
     static const char str26[] = "<t>&#xffff;</t>";
     static const char str27[] = "<t><</t>";
+    static const char str28[] = "<t>&#x0;</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};
@@ -3649,6 +3650,7 @@ static void test_entities(void)
         { str25, WS_E_INVALID_FORMAT },
         { str26, WS_E_INVALID_FORMAT },
         { str27, WS_E_INVALID_FORMAT },
+        { str28, WS_E_INVALID_FORMAT },
     };
     HRESULT hr;
     WS_XML_READER *reader;




More information about the wine-cvs mailing list