Commit 0762f672 authored by Ulrich Czekalla's avatar Ulrich Czekalla Committed by Alexandre Julliard

riched20: Add check to ensure iob is a valid index into the object array.

parent c2daea89
......@@ -1407,7 +1407,7 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
}
else
{
if (iob > IRichEditOle_GetObjectCount(me))
if (iob < 0 || iob >= IRichEditOle_GetObjectCount(me))
return E_INVALIDARG;
LIST_FOR_EACH_ENTRY(reobj, &This->editor->reobj_list, struct re_object, entry)
{
......
......@@ -3296,12 +3296,18 @@ static void test_InsertObject(void)
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo2.polesite, 2);
hr = IRichEditOle_GetObject(reole, 3, &received_reo4, REO_GETOBJ_POLESITE);
ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
hr = IRichEditOle_GetObject(reole, 4, &received_reo4, REO_GETOBJ_POLESITE);
ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
hr = IRichEditOle_GetObject(reole, 1024, &received_reo4, REO_GETOBJ_POLESITE);
ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
hr = IRichEditOle_GetObject(reole, -10, &received_reo4, REO_GETOBJ_POLESITE);
ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
/* received_reo4 will be zeroed before be used */
hr = IRichEditOle_GetObject(reole, 2, &received_reo4, REO_GETOBJ_NO_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment