riched20: Add check to ensure iob is a valid index into the object array.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c2daea89c4
commit
0762f6726c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue