Wolfram Sang : user32/tests: Modify proper fields instead of magic offsets.
Module: wine Branch: master Commit: 25923d2f16c56bb6840f92b2c4b0cc2b2ef927aa URL: http://source.winehq.org/git/wine.git/?a=commit;h=25923d2f16c56bb6840f92b2c4... Author: Wolfram Sang <wolfram(a)the-dreams.de> Date: Thu Feb 24 22:12:07 2011 +0100 user32/tests: Modify proper fields instead of magic offsets. --- dlls/user32/tests/cursoricon.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c index cba5704..454606a 100644 --- a/dlls/user32/tests/cursoricon.c +++ b/dlls/user32/tests/cursoricon.c @@ -854,7 +854,7 @@ static void test_LoadImage(void) DWORD error, bytes_written; CURSORICONFILEDIR *icon_data; CURSORICONFILEDIRENTRY *icon_entry; - BITMAPINFOHEADER *icon_header; + BITMAPINFOHEADER *icon_header, *bitmap_header; ICONINFO icon_info; #define ICON_WIDTH 32 @@ -981,13 +981,17 @@ static void test_LoadImage(void) test_LoadImageFile("GIF (2x2 pixel)", gif4pixel, sizeof(gif4pixel), "gif", 0); test_LoadImageFile("JPG", jpgimage, sizeof(jpgimage), "jpg", 0); test_LoadImageFile("PNG", pngimage, sizeof(pngimage), "png", 0); + /* Check failure for broken BMP images */ - bmpimage[0x14]++; /* biHeight > 65535 */ + bitmap_header = (BITMAPINFOHEADER *)(bmpimage + sizeof(BITMAPFILEHEADER)); + + bitmap_header->biHeight = 65536; test_LoadImageFile("BMP (too high)", bmpimage, sizeof(bmpimage), "bmp", 0); - bmpimage[0x14]--; - bmpimage[0x18]++; /* biWidth > 65535 */ + bitmap_header->biHeight = 1; + + bitmap_header->biWidth = 65536; test_LoadImageFile("BMP (too wide)", bmpimage, sizeof(bmpimage), "bmp", 0); - bmpimage[0x18]--; + bitmap_header->biWidth = 1; } static void test_CreateIconFromResource(void)
participants (1)
-
Alexandre Julliard