diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c index 5b5dc69a02f..d67c47a701d 100644 --- a/dlls/webservices/reader.c +++ b/dlls/webservices/reader.c @@ -1035,7 +1035,7 @@ static inline unsigned int read_utf8_char( struct reader *reader, unsigned int * } len = utf8_length[ch - 0x80]; if (reader->read_pos + len >= reader->read_size) return 0; - end = reader->read_bufptr + reader->read_pos + len; + end = reader->read_bufptr + reader->read_pos + len + 1; res = ch & utf8_mask[len]; switch (len) diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c index 23c3f108527..b19bc8cdcc1 100644 --- a/dlls/webservices/tests/reader.c +++ b/dlls/webservices/tests/reader.c @@ -1325,6 +1325,8 @@ static void test_WsReadType(void) static const WCHAR testW[] = {'t','e','s','t',0}; static const GUID guid1 = {0,0,0,{0,0,0,0,0,0,0,0}}; static const GUID guid2 = {0,0,0,{0,0,0,0,0,0,0,0xa1}}; + static const char utf8[] = {'<','t','>',0xe2,0x80,0x99,'<','/','t','>'}; + static const WCHAR utf8W[] = {0x2019,0}; HRESULT hr; WS_XML_READER *reader; WS_HEAP *heap; @@ -1636,6 +1638,14 @@ static void test_WsReadType(void) WS_READ_REQUIRED_VALUE, heap, &val_bytes, sizeof(val_bytes), NULL ); ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr ); + val_str = NULL; + prepare_type_test( reader, utf8, sizeof(utf8) ); + hr = WsReadType( reader, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL, + WS_READ_REQUIRED_POINTER, heap, &val_str, sizeof(val_str), NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( val_str != NULL, "pointer not set\n" ); + if (val_str) ok( !lstrcmpW( val_str, utf8W ), "wrong data %s\n", wine_dbgstr_w(val_str) ); + WsFreeReader( reader ); WsFreeHeap( heap ); }