gdi32: Limit the allocation size to the useful data when converting DIB bits.

This commit is contained in:
Alexandre Julliard 2012-10-10 17:06:06 +02:00
parent 86cf1126a5
commit 34b70728f3
1 changed files with 3 additions and 0 deletions

View File

@ -162,9 +162,12 @@ DWORD convert_bits( const BITMAPINFO *src_info, struct bitblt_coords *src,
{
void *ptr;
DWORD err;
BOOL top_down = dst_info->bmiHeader.biHeight < 0;
dst_info->bmiHeader.biWidth = src->visrect.right - src->visrect.left;
dst_info->bmiHeader.biHeight = src->visrect.bottom - src->visrect.top;
dst_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info );
if (top_down) dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight;
if (!(ptr = HeapAlloc( GetProcessHeap(), 0, dst_info->bmiHeader.biSizeImage )))
return ERROR_OUTOFMEMORY;