LibGfx: assert Bitmap::set_pixel does not write out of bounds
This commit is contained in:
parent
5567408bab
commit
23c4f1a3d4
Notes:
sideshowbarker
2024-07-19 01:35:36 +09:00
Author: https://github.com/peterdn Commit: https://github.com/SerenityOS/serenity/commit/23c4f1a3d41 Pull-request: https://github.com/SerenityOS/serenity/pull/3899 Issue: https://github.com/SerenityOS/serenity/issues/3484 Reviewed-by: https://github.com/awesomekling
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue