Make plausibility check easier to understand.

Explicitly check that Bitmap_Head.biHeight is not G_MININT32
instead of relying on ABS(G_MININT32) being negative.
This commit is contained in:
Nils Philippsen 2009-11-16 17:15:32 +01:00
parent 7810dede39
commit 43d57c6663
1 changed files with 3 additions and 1 deletions

View File

@ -423,8 +423,10 @@ ReadBMP (const gchar *name,
return -1;
}
/* biHeight may be negative, but G_MININT32 is dangerous because:
G_MININT32 == -(G_MININT32) */
if (Bitmap_Head.biWidth < 0 ||
ABS (Bitmap_Head.biHeight) < 0)
Bitmap_Head.biHeight == G_MININT32)
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("'%s' is not a valid BMP file"),