Commit 761391f1 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdiplus: Add a check for passed buffer size to GdipGetRegionData.

parent 8dc170e2
......@@ -828,12 +828,22 @@ GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE *buffer, UINT size,
DWORD num_children;
} *region_header;
INT filled = 0;
UINT required;
GpStatus status;
TRACE("%p, %p, %d, %p\n", region, buffer, size, needed);
if (!(region && buffer && size))
if (!region || !buffer || !size)
return InvalidParameter;
status = GdipGetRegionDataSize(region, &required);
if (status != Ok) return status;
if (size < required)
{
if (needed) *needed = size;
return InsufficientBuffer;
}
region_header = (struct _region_header *)buffer;
region_header->size = sizeheader_size + get_element_size(&region->node);
region_header->checksum = 0;
......
......@@ -133,11 +133,8 @@ static void test_getregiondata(void)
memset(buf, 0xee, sizeof(buf));
needed = 0;
status = GdipGetRegionData(region, (BYTE*)buf, 4, &needed);
todo_wine
ok(status == InsufficientBuffer, "status %08x\n", status);
todo_wine
expect(4, needed);
todo_wine
expect_dword(buf, 0xeeeeeeee);
memset(buf, 0xee, sizeof(buf));
......
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