Commit ca74893a authored by Matthias Clasen's avatar Matthias Clasen

bmp: Reject bogus depth

Erroring out early if we find a bogus image depth is
the right thing to do, and avoids possible memory
overruns later on.

https://bugzilla.gnome.org/show_bug.cgi?id=747605
parent 3d809a8a
......@@ -318,6 +318,15 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
return FALSE;
}
if (State->Header.depth > 32)
{
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has unsupported depth"));
State->read_state = READ_STATE_ERROR;
}
if (State->Header.size == 12)
clrUsed = 1 << State->Header.depth;
else
......
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