1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07: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

@ -189,8 +189,8 @@ protected:
private:
virtual bool is_window() const override final { return true; }
NonnullRefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::Size&);
NonnullRefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::Size&);
RefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::Size&);
RefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::Size&);
void set_current_backing_bitmap(Gfx::Bitmap&, bool flush_immediately = false);
void flip(const Vector<Gfx::Rect, 32>& dirty_rects);
void force_update();