[client] transport: allow packed BGR storage heights

This commit is contained in:
Geoffrey McRae
2026-08-24 13:21:31 +10:00
parent f3a6964ade
commit 4e75351c78

View File

@@ -285,19 +285,24 @@ static inline bool lgTransport_validateFrameFormat(
const uint64_t rowBytes = (uint64_t)format->stride * storageBpp;
const uint64_t size = (uint64_t)format->dataHeight * format->pitch;
if (format->dataWidth > format->stride || rowBytes != format->pitch ||
size > INT_MAX || format->dataHeight > format->frameHeight ||
(format->dataHeight < format->frameHeight &&
!(flags & LG_TRANSPORT_FRAME_TRUNCATED)))
size > INT_MAX || format->dataHeight > format->frameHeight)
return false;
if (format->type == FRAME_TYPE_BGR_32)
{
/* Packed BGR rows are stored in a reshaped 32-bpp surface, so its storage
* height may be shorter than the logical frame without truncation. */
if (format->dataWidth != format->stride ||
(uint64_t)format->frameWidth * 3U > format->pitch)
return false;
}
else if (format->dataWidth != format->frameWidth)
else
{
if (format->dataWidth != format->frameWidth ||
(format->dataHeight < format->frameHeight &&
!(flags & LG_TRANSPORT_FRAME_TRUNCATED)))
return false;
}
if (dataSize)
*dataSize = (size_t)size;