[PATCH v3] gdi32/tests: Reserve sufficient room for DIB data.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48054 Signed-off-by: Jeff Smith <whydoubt(a)gmail.com> --- dlls/gdi32/tests/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index 8fe160546c..8f0f6601b3 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -913,7 +913,7 @@ static void test_dibsections(void) static void test_dib_formats(void) { BITMAPINFO *bi; - char data[256]; + char data[2048]; /* 2 x 2 pixels, max 64 bits-per-pixel, max 64 planes */ void *bits; int planes, bpp, compr, format; HBITMAP hdib, hbmp; -- 2.23.0
On Mon, Nov 25, 2019 at 8:38 PM Dmitry Timoshkov <dmitry(a)baikal.ru> wrote:
Jeff Smith <whydoubt(a)gmail.com> wrote:
- char data[256]; + char data[2048]; /* 2 x 2 pixels, max 64 bits-per-pixel, max 64 planes */
Using data from your original patch I get 2544 bytes.
If you plug the numbers into a standard calculator, that is what you would get. However, this is integer math, so... ((width * bpp + 31) / 32) * 4 * height * planes ((2 * 64 + 31) / 32) * 4 * 2 * 64 ((128 + 31) / 32) * 4 * 2 * 64 <---- 128 bits to hold data for 1 row of pixels (159 / 32) * 4 * 2 * 64 4 * 4 * 2 * 64 16 * 2 * 64 <---- 16 byte stride (1 row of pixels, padded to 4-byte boundary) 32 * 64 <---- 32 bytes for a single plane 2048 <---- 2048 bytes for all planes My comment in the latest patch does gloss over the difference between between line width and line stride, which is effectively identical in this case. Jeff
participants (3)
-
Dmitry Timoshkov -
Huw Davies -
Jeff Smith