Commit 490754b3 authored by Augusto Fraga Giachero's avatar Augusto Fraga Giachero Committed by Davis E. King

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.
parent 4fec20c4
......@@ -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;
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment