mirror of https://github.com/davisking/dlib.git
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:
parent
4fec20c472
commit
490754b30f
|
@ -44,7 +44,7 @@ namespace dlib
|
||||||
unsigned long bfReserved;
|
unsigned long bfReserved;
|
||||||
unsigned long biSize;
|
unsigned long biSize;
|
||||||
unsigned long biWidth;
|
unsigned long biWidth;
|
||||||
long biHeight;
|
int32 biHeight;
|
||||||
unsigned short biBitCount;
|
unsigned short biBitCount;
|
||||||
unsigned long biCompression;
|
unsigned long biCompression;
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue