From acf20618378124b9c0d10fb55b741e98c566b91f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 15 Apr 2020 17:15:06 +0200 Subject: LibGfx: Use Checked::multiplication_would_overflow() --- Libraries/LibGfx/Bitmap.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Libraries/LibGfx') diff --git a/Libraries/LibGfx/Bitmap.cpp b/Libraries/LibGfx/Bitmap.cpp index 84bfe4e0ea..e7a467a177 100644 --- a/Libraries/LibGfx/Bitmap.cpp +++ b/Libraries/LibGfx/Bitmap.cpp @@ -43,10 +43,7 @@ static bool size_would_overflow(BitmapFormat format, const Size& size) { if (size.width() < 0 || size.height() < 0) return true; - Checked size_in_bytes = static_cast(size.width()); - size_in_bytes *= size.height(); - size_in_bytes *= Bitmap::bpp_for_format(format); - return size_in_bytes.has_overflow(); + return Checked::multiplication_would_overflow(size.width(), size.height(), Bitmap::bpp_for_format(format)); } RefPtr Bitmap::create(BitmapFormat format, const Size& size) -- cgit v1.2.3