From e3851a87404841b3550e78f1b1bf2f153a1a280b Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 24 Jan 2018 14:30:02 +0100 Subject: [PATCH] webervices/tests: Add tests for out of range string IDs. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/webservices/tests/reader.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c index 9879fac4cfd..7064cf0f82a 100644 --- a/dlls/webservices/tests/reader.c +++ b/dlls/webservices/tests/reader.c @@ -5612,6 +5612,10 @@ static void test_dictionary(void) {0x40,0x01,'t',0x0a,0x0a,0x01}; static const char test8[] = {0x40,0x01,'t',0x0b,0x01,'p',0x0a,0x01}; + static const char test9[] = + {0x42,0x0c,0x01}; + static const char test10[] = + {0x42,0x04,0xab,0x0c,0x01}; const WS_XML_NODE *node; const WS_XML_ELEMENT_NODE *elem; const WS_XML_ATTRIBUTE *attr; @@ -5940,6 +5944,23 @@ static void test_dictionary(void) ok( hr == S_OK, "got %08x\n", hr ); ok( node->nodeType == WS_XML_NODE_TYPE_END_ELEMENT, "got %u\n", node->nodeType ); + /* element name string id out of range */ + hr = set_input_bin( reader, test9, sizeof(test9), &dict ); + ok( hr == S_OK, "got %08x\n", hr ); + hr = WsReadNode( reader, NULL ); + ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr ); + + /* text string id out of range */ + hr = set_input_bin( reader, test10, sizeof(test10), &dict ); + ok( hr == S_OK, "got %08x\n", hr ); + hr = WsReadNode( reader, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + hr = WsGetReaderNode( reader, &node, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( node->nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", node->nodeType ); + hr = WsReadNode( reader, NULL ); + ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr ); + hr = WsGetDictionary( 0, NULL, NULL ); ok( hr == E_INVALIDARG, "got %08x\n", hr );