From 4475e21b7eab24f71ad214e7a3cb6993d2ef4b80 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 3 Mar 2026 08:32:15 +0100 Subject: [PATCH] [codec,rfx] return nullptr if input parameters are invalid rfx_encode_messages maxDataSize must be > 1024 or the function will fail. Add a check to abort early if this is the case. while this is a usage error, it is helpful to have proper error handling in the function as well. --- libfreerdp/codec/rfx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index b0c322c5d..cbdf44668 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -1952,6 +1952,9 @@ static inline RFX_MESSAGE* rfx_split_message(RFX_CONTEXT* WINPR_RESTRICT context WINPR_ASSERT(message); WINPR_ASSERT(numMessages); + if (maxDataSize <= 1024) + return nullptr; + maxDataSize -= 1024; /* reserve enough space for headers */ *numMessages = ((message->tilesDataSize + maxDataSize) / maxDataSize) * 4ull;