/* Shamelessly ripped from dlls/oleaut32/tests/olepicture.c */
/* 1x1 pixel gif */
-static const unsigned char gifimage[35] = {
+static unsigned char gifimage[35] = {
0x47,0x49,0x46,0x38,0x37,0x61,0x01,0x00,0x01,0x00,0x80,0x00,0x00,0xff,0xff,0xff,
0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
0x01,0x00,0x3b
};
/* 1x1 pixel jpg */
-static const unsigned char jpgimage[285] = {
+static unsigned char jpgimage[285] = {
0xff,0xd8,0xff,0xe0,0x00,0x10,0x4a,0x46,0x49,0x46,0x00,0x01,0x01,0x01,0x01,0x2c,
0x01,0x2c,0x00,0x00,0xff,0xdb,0x00,0x43,0x00,0x05,0x03,0x04,0x04,0x04,0x03,0x05,
0x04,0x04,0x04,0x05,0x05,0x05,0x06,0x07,0x0c,0x08,0x07,0x07,0x07,0x07,0x0f,0x0b,
};
/* 1x1 pixel png */
-static const unsigned char pngimage[285] = {
+static unsigned char pngimage[285] = {
0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53,
0xde,0x00,0x00,0x00,0x09,0x70,0x48,0x59,0x73,0x00,0x00,0x0b,0x13,0x00,0x00,0x0b,
/* 1x1 pixel bmp with gap between palette and bitmap. Correct bitmap contains only
zeroes, gap is 0xFF. */
-static const unsigned char bmpimage[70] = {
+static unsigned char bmpimage[70] = {
0x42,0x4d,0x46,0x00,0x00,0x00,0xDE,0xAD,0xBE,0xEF,0x42,0x00,0x00,0x00,0x28,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x04,0x00,0x00,0x00,0x12,0x0b,0x00,0x00,0x12,0x0b,0x00,0x00,0x02,0x00,
};
/* 2x2 pixel gif */
-static const unsigned char gif4pixel[42] = {
+static unsigned char gif4pixel[42] = {
0x47,0x49,0x46,0x38,0x37,0x61,0x02,0x00,0x02,0x00,0xa1,0x00,0x00,0x00,0x00,0x00,
0x39,0x62,0xfc,0xff,0x1a,0xe5,0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x02,0x00,
0x02,0x00,0x00,0x02,0x03,0x14,0x16,0x05,0x00,0x3b
ok(color_match(pixel, 0x00ffffff), "Pixel is 0x%08x\n", pixel);
}
-static void test_LoadImageFile(const unsigned char * image_data,
+static void test_LoadImageFile(unsigned char * image_data,
unsigned int image_size, const char * ext, BOOL expect_success)
{
HANDLE handle;
"Last error: %u\n", error);
if (handle != NULL) DestroyIcon(handle);
- /* Load as bitmap. Should succeed if bmp, fail for everything else */
+ /* Load as bitmap. Should succeed for correct bmp, fail for everything else */
SetLastError(0xdeadbeef);
handle = LoadImageA(NULL, filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
error = GetLastError();
test_LoadImageFile(gif4pixel, sizeof(gif4pixel), "gif", 0);
test_LoadImageFile(jpgimage, sizeof(jpgimage), "jpg", 0);
test_LoadImageFile(pngimage, sizeof(pngimage), "png", 0);
+ /* Check failure for broken BMP images */
+ bmpimage[0x14]++; /* biHeight > 65535 */
+ test_LoadImageFile(bmpimage, sizeof(bmpimage), "bmp", 0);
+ bmpimage[0x14]--;
+ bmpimage[0x18]++; /* biWidth > 65535 */
+ test_LoadImageFile(bmpimage, sizeof(bmpimage), "bmp", 0);
+ bmpimage[0x18]--;
}
static void test_CreateIconFromResource(void)