From 32e2f81cc5701d169036b86047642cf96a20435f Mon Sep 17 00:00:00 2001 From: Daniel Bungert Date: Wed, 14 Oct 2015 14:16:19 -0600 Subject: [PATCH] Clamp ultra-wide glyph opRight vals to desktop width --- libfreerdp/cache/glyph.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libfreerdp/cache/glyph.c b/libfreerdp/cache/glyph.c index 037c5a5d9..0157d40bc 100644 --- a/libfreerdp/cache/glyph.c +++ b/libfreerdp/cache/glyph.c @@ -260,6 +260,12 @@ BOOL update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fastIndex) if (opRight == 0) opRight = fastIndex->bkRight; + /* Server can send a massive number (32766) which appears to be + * undocumented special behavior for "Erase all the way right". + * X11 has nondeterministic results asking for a draw that wide. */ + if (opRight > context->instance->settings->DesktopWidth) + opRight = context->instance->settings->DesktopWidth; + if (x == -32768) x = fastIndex->bkLeft; @@ -313,6 +319,10 @@ BOOL update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph) if (opRight == 0) opRight = fastGlyph->bkRight; + /* See update_gdi_fast_index opRight comment. */ + if (opRight > context->instance->settings->DesktopWidth) + opRight = context->instance->settings->DesktopWidth; + if (x == -32768) x = fastGlyph->bkLeft;