Fix bad_alloc exception when loading bmp images with negative height (#1341)

The 'long' type can be 32 bits or 64 bits depending on what compiler
you are using (LLP64 vs LP64). If the long type is 64 bits the
biHeight variable will receive a very big number when the bmp image
height is negative, causing a std::bad_alloc exception when calling
the 'image.set_size' method.
This commit is contained in:
Augusto Fraga Giachero 2018-06-02 14:16:04 -03:00 committed by Davis E. King
parent 4fec20c472
commit 490754b30f
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,7 @@ namespace dlib
unsigned long bfReserved;
unsigned long biSize;
unsigned long biWidth;
long biHeight;
int32 biHeight;
unsigned short biBitCount;
unsigned long biCompression;
/*