[PATCH] gdi32/tests: Reserve sufficient room for DIB data.
Huw Davies
huw at codeweavers.com
Mon Nov 25 03:48:00 CST 2019
On Fri, Nov 22, 2019 at 01:40:58PM -0600, Jeff Smith wrote:
> Factor out the magic values needed to derive the maximum image data
> buffer length. If the values need to be changed in the future, the
> derived value will be automatically recalculated.
>
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48054
> Signed-off-by: Jeff Smith <whydoubt at gmail.com>
> ---
> dlls/gdi32/tests/bitmap.c | 46 +++++++++++++++++++++++----------------
> 1 file changed, 27 insertions(+), 19 deletions(-)
>
> diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
> index 8fe160546c..130ef3ca3a 100644
> --- a/dlls/gdi32/tests/bitmap.c
> +++ b/dlls/gdi32/tests/bitmap.c
> @@ -910,10 +910,18 @@ static void test_dibsections(void)
> ReleaseDC(0, hdc);
> }
>
> +#define DATA_WIDTH 2
> +#define DATA_HEIGHT 2
> +#define MAX_PLANES 64
> +#define MAX_BPP 64
> +#define DATA_STRIDE_LENGTH (((DATA_WIDTH * MAX_BPP + 31) / 32) * 4)
> +#define DATA_PLANE_LENGTH (DATA_STRIDE_LENGTH * DATA_HEIGHT)
> +#define DATA_LENGTH (DATA_PLANE_LENGTH * MAX_PLANES)
> +
> static void test_dib_formats(void)
> {
> BITMAPINFO *bi;
> - char data[256];
> + char data[DATA_LENGTH];
I think simply fixing the array size is more appropriate here.
Huw.
More information about the wine-devel
mailing list