mirror of
https://github.com/reactos/wine.git
synced 2024-12-11 13:26:00 +00:00
gdiplus: Add a check for passed buffer size to GdipGetRegionData.
This commit is contained in:
parent
8dc170e2ca
commit
761391f156
@ -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(®ion->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));
|
||||
|
Loading…
Reference in New Issue
Block a user