From fc2d5dbf178797908a849be1fcb50fd8b5ee5754 Mon Sep 17 00:00:00 2001 From: Scott Brenner Date: Sat, 24 May 2025 21:04:46 -0700 Subject: [PATCH] Fix for code scanning alert: Multiplication result converted to larger type Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/RageSurfaceUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RageSurfaceUtils.cpp b/src/RageSurfaceUtils.cpp index af0c0570af..c677acdcb1 100644 --- a/src/RageSurfaceUtils.cpp +++ b/src/RageSurfaceUtils.cpp @@ -767,7 +767,7 @@ bool RageSurfaceUtils::SaveSurface( const RageSurface *img, RString file ) f.Write( img->format->palette->colors, img->format->palette->ncolors * sizeof(RageSurfaceColor) ); } - f.Write( img->pixels, img->h * img->pitch ); + f.Write( img->pixels, static_cast(img->h) * img->pitch ); return true; } @@ -808,7 +808,7 @@ RageSurface *RageSurfaceUtils::LoadSurface( RString file ) return nullptr; } - if( f.Read( img->pixels, h.height * h.pitch ) != h.height * h.pitch ) + if( f.Read( img->pixels, static_cast(h.height) * h.pitch ) != static_cast(h.height) * h.pitch ) { delete img; return nullptr;