From bdb3909a7713fb0b3d94c9676fe44d19de80eb4b Mon Sep 17 00:00:00 2001 From: akallabeth <akallabeth@posteo.net> Date: Tue, 22 Aug 2023 10:06:15 +0200 Subject: [PATCH] [codec,nsc] ensure integer width ensure multiplication result is 64bit (cherry picked from commit adb1630d623f76b314631e338559afe4d62b24fa) --- libfreerdp/codec/nsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libfreerdp/codec/nsc.c b/libfreerdp/codec/nsc.c index 66aa275f1434..cd65f072f000 100644 --- a/libfreerdp/codec/nsc.c +++ b/libfreerdp/codec/nsc.c @@ -247,7 +247,7 @@ static BOOL nsc_context_initialize(NSC_CONTEXT* context, wStream* s) if (!nsc_stream_initialize(context, s)) return FALSE; - const size_t blength = context->width * context->height * 4; + const size_t blength = context->width * context->height * 4ull; if (!context->BitmapData) { @@ -273,7 +273,7 @@ static BOOL nsc_context_initialize(NSC_CONTEXT* context, wStream* s) const UINT32 tempWidth = ROUND_UP_TO(context->width, 8); const UINT32 tempHeight = ROUND_UP_TO(context->height, 2); /* The maximum length a decoded plane can reach in all cases */ - const size_t plength = tempWidth * tempHeight; + const size_t plength = 1ull * tempWidth * tempHeight; if (plength > context->priv->PlaneBuffersLength) {