1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 21:37:35 +00:00

LibGfx: Don't allow creating bitmaps whose sizes would overflow

If the area or size_in_bytes calculation for a Gfx::Bitmap would
overflow, we now refuse to create such a bitmap and return nullptr.

Thanks to @itamar8910 for finding this! :^)
This commit is contained in:
Andreas Kling 2020-04-15 11:57:24 +02:00
parent a8406aa117
commit 228ace854c
5 changed files with 62 additions and 21 deletions

View file

@ -80,7 +80,7 @@ static RefPtr<Gfx::Bitmap> s_background;
Card::Card(Type type, uint8_t value)
: m_rect(Gfx::Rect({}, { width, height }))
, m_front(Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { width, height }))
, m_front(*Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { width, height }))
, m_type(type)
, m_value(value)
{