The problem is that our bitmap loading code wasn''t really robust. The problem is with this line:
bitmapImage = (unsigned char*)malloc(bitmapInfoHeader->biSizeImage);
For an uncompressed RGB image, it is valid for biSizeImage to be zero. In this case, you should use a combination of the biWidth, biHeight, and biBitcount members to determine how many bytes you really need for the bitmap. e.g.
// allocate enough memory for the bitmap image data int imageSize = bitmapInfoHeader->biSizeImage; if (imageSize == 0) imageSize = bitmapInfoHeader->biWidth * bitmapInfoHeader->biHeight * bitmapInfoHeader->biBitCount/8; bitmapImage = (unsigned char*)malloc(imageSize );... // read in the bitmap image data fread(bitmapImage, 1, imageSize, filePtr);