From d8a1ac342ae375644c70579c33b5cf38fb43b083 Mon Sep 17 00:00:00 2001 From: akallabeth <akallabeth@posteo.net> Date: Tue, 22 Aug 2023 09:41:28 +0200 Subject: [PATCH] [warnings] fix integer multiplications Ensure the integer width for size arguments is 64bit in a multiplication. Leading 64bit constant 1ull expands width, a trailing one is ignored. (cherry picked from commit b3f0ab2814e39e0f779343c53699e7dc6c1b1c22) --- libfreerdp/gdi/gfx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libfreerdp/gdi/gfx.c b/libfreerdp/gdi/gfx.c index 764f9076f1a0..3970715e0187 100644 --- a/libfreerdp/gdi/gfx.c +++ b/libfreerdp/gdi/gfx.c @@ -726,7 +726,7 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context, { UINT32 x, y; - if (Stream_GetRemainingLength(&s) < cmd->height * cmd->width * 1ULL) + if (Stream_GetRemainingLength(&s) < 1ull * cmd->height * cmd->width) return ERROR_INVALID_DATA; for (y = cmd->top; y < cmd->top + cmd->height; y++) @@ -1025,7 +1025,7 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context, } surface->scanline = gfx_align_scanline(surface->width * 4UL, 16); - surface->data = (BYTE*)_aligned_malloc(surface->scanline * surface->height * 1ULL, 16); + surface->data = (BYTE*)_aligned_malloc(1ull * surface->scanline * surface->height, 16); if (!surface->data) {