Skip to content

Commit 1c7b291

Browse files
committed
[core,gcc] fix MONITOR_DEF read/write
coordinates are signed.
1 parent 2c72722 commit 1c7b291

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

libfreerdp/core/gcc.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,18 +2138,13 @@ BOOL gcc_read_client_monitor_data(wStream* s, rdpMcs* mcs)
21382138

21392139
for (UINT32 index = 0; index < monitorCount; index++)
21402140
{
2141-
INT32 left = 0;
2142-
INT32 top = 0;
2143-
INT32 right = 0;
2144-
INT32 bottom = 0;
2145-
INT32 flags = 0;
21462141
rdpMonitor* current = &settings->MonitorDefArray[index];
21472142

2148-
Stream_Read_INT32(s, left); /* left */
2149-
Stream_Read_INT32(s, top); /* top */
2150-
Stream_Read_INT32(s, right); /* right */
2151-
Stream_Read_INT32(s, bottom); /* bottom */
2152-
Stream_Read_INT32(s, flags); /* flags */
2143+
const INT32 left = Stream_Get_INT32(s); /* left */
2144+
const INT32 top = Stream_Get_INT32(s); /* top */
2145+
const INT32 right = Stream_Get_INT32(s); /* right */
2146+
const INT32 bottom = Stream_Get_INT32(s); /* bottom */
2147+
const UINT32 flags = Stream_Get_UINT32(s); /* flags */
21532148
current->x = left;
21542149
current->y = top;
21552150
current->width = right - left + 1;
@@ -2205,19 +2200,19 @@ BOOL gcc_write_client_monitor_data(wStream* s, const rdpMcs* mcs)
22052200
for (UINT32 i = 0; i < settings->MonitorCount; i++)
22062201
{
22072202
const rdpMonitor* current = &settings->MonitorDefArray[i];
2208-
const UINT32 left = WINPR_ASSERTING_INT_CAST(uint32_t, current->x - baseX);
2209-
const UINT32 top = WINPR_ASSERTING_INT_CAST(uint32_t, current->y - baseY);
2210-
const UINT32 right = left + WINPR_ASSERTING_INT_CAST(uint32_t, current->width - 1);
2211-
const UINT32 bottom = top + WINPR_ASSERTING_INT_CAST(uint32_t, current->height - 1);
2203+
const INT32 left = current->x - baseX;
2204+
const INT32 top = current->y - baseY;
2205+
const INT32 right = left + current->width - 1;
2206+
const INT32 bottom = top + current->height - 1;
22122207
const UINT32 flags = current->is_primary ? MONITOR_PRIMARY : 0;
22132208
WLog_DBG(TAG,
2214-
"Monitor[%" PRIu32 "]: top=%" PRIu32 ", left=%" PRIu32 ", bottom=%" PRIu32
2215-
", right=%" PRIu32 ", flags=%" PRIu32,
2209+
"Monitor[%" PRIu32 "]: top=%" PRId32 ", left=%" PRId32 ", bottom=%" PRId32
2210+
", right=%" PRId32 ", flags=%" PRIu32,
22162211
i, top, left, bottom, right, flags);
2217-
Stream_Write_UINT32(s, left); /* left */
2218-
Stream_Write_UINT32(s, top); /* top */
2219-
Stream_Write_UINT32(s, right); /* right */
2220-
Stream_Write_UINT32(s, bottom); /* bottom */
2212+
Stream_Write_INT32(s, left); /* left */
2213+
Stream_Write_INT32(s, top); /* top */
2214+
Stream_Write_INT32(s, right); /* right */
2215+
Stream_Write_INT32(s, bottom); /* bottom */
22212216
Stream_Write_UINT32(s, flags); /* flags */
22222217
}
22232218
}

0 commit comments

Comments
 (0)