Skip to content

Commit 3b7c804

Browse files
committed
[core,gcc] add monitor rect sanity checks
1 parent 9d93ba1 commit 3b7c804

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

libfreerdp/core/gcc.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,10 +2145,19 @@ BOOL gcc_read_client_monitor_data(wStream* s, rdpMcs* mcs)
21452145
const INT32 right = Stream_Get_INT32(s); /* right */
21462146
const INT32 bottom = Stream_Get_INT32(s); /* bottom */
21472147
const UINT32 flags = Stream_Get_UINT32(s); /* flags */
2148+
2149+
if ((left > right) || (bottom > top))
2150+
return FALSE;
2151+
2152+
const INT32 w = right - left;
2153+
const INT32 h = bottom - top;
2154+
if ((w >= INT32_MAX) || (h >= INT32_MAX))
2155+
return FALSE;
2156+
21482157
current->x = left;
21492158
current->y = top;
2150-
current->width = right - left + 1;
2151-
current->height = bottom - top + 1;
2159+
current->width = w + 1;
2160+
current->height = h + 1;
21522161
current->is_primary = (flags & MONITOR_PRIMARY) ? TRUE : FALSE;
21532162
}
21542163

0 commit comments

Comments
 (0)