diff options
author | Peter Nelson <peter@peterdn.com> | 2020-11-01 16:03:48 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-01 20:13:25 +0100 |
commit | 23c4f1a3d41f2697a04e60ffa3cf678e6e1bb692 (patch) | |
tree | f7c31f4c664fb057e78e8cf896d1e675297dae6a | |
parent | 5567408bab9574cce070f2e3fbcbd5026c77c59b (diff) | |
download | serenity-23c4f1a3d41f2697a04e60ffa3cf678e6e1bb692.zip |
LibGfx: assert Bitmap::set_pixel does not write out of bounds
-rw-r--r-- | Libraries/LibGfx/Bitmap.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibGfx/Bitmap.h b/Libraries/LibGfx/Bitmap.h index 66b42cf241..24baa2281d 100644 --- a/Libraries/LibGfx/Bitmap.h +++ b/Libraries/LibGfx/Bitmap.h @@ -300,11 +300,13 @@ inline Color Bitmap::get_pixel(int x, int y) const template<> inline void Bitmap::set_pixel<StorageFormat::RGB32>(int x, int y, Color color) { + ASSERT(rect().contains(x, y)); scanline(y)[x] = color.value(); } template<> inline void Bitmap::set_pixel<StorageFormat::RGBA32>(int x, int y, Color color) { + ASSERT(rect().contains(x, y)); scanline(y)[x] = color.value(); // drop alpha } inline void Bitmap::set_pixel(int x, int y, Color color) |