Jacek Caban : mshtml: Fixed argument checking in IHTMLDOMChildrenCollection ::item.

Alexandre Julliard julliard at winehq.org
Tue Jun 24 06:45:14 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jun 23 20:03:06 2008 -0500

mshtml: Fixed argument checking in IHTMLDOMChildrenCollection::item.

---

 dlls/mshtml/htmlnode.c  |    2 +-
 dlls/mshtml/tests/dom.c |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index bfa999f..056e38a 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -166,7 +166,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollection_item(IHTMLDOMChildrenCollection
     TRACE("(%p)->(%ld %p)\n", This, index, ppItem);
 
     nsIDOMNodeList_GetLength(This->nslist, &length);
-    if(index < 0 || index > length)
+    if(index < 0 || index >= length)
         return E_INVALIDARG;
 
     nsres = nsIDOMNodeList_Item(This->nslist, index, &nsnode);
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 7d57b24..4da9110 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2042,6 +2042,11 @@ static void test_elems(IHTMLDocument2 *doc)
         ok(hres == E_INVALIDARG, "item failed: %08x, expected E_INVALIDARG\n", hres);
         ok(disp == (void*)0xdeadbeef, "disp=%p\n", disp);
 
+        disp = (void*)0xdeadbeef;
+        hres = IHTMLDOMChildrenCollection_item(child_col, length, &disp);
+        ok(hres == E_INVALIDARG, "item failed: %08x, expected E_INVALIDARG\n", hres);
+        ok(disp == (void*)0xdeadbeef, "disp=%p\n", disp);
+
         test_child_col_disp(child_col);
 
         IHTMLDOMChildrenCollection_Release(child_col);




More information about the wine-cvs mailing list