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>
This commit is contained in:
Scott Brenner
2025-05-24 21:04:46 -07:00
committed by teejusb
parent 7ff2002bec
commit fc2d5dbf17
+2 -2
View File
@@ -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<size_t>(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<size_t>(h.height) * h.pitch ) != static_cast<size_t>(h.height) * h.pitch )
{
delete img;
return nullptr;