diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2021-12-14 15:00:03 +0200 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2021-12-15 18:43:01 +0000 |
commit | 35b4681c79480d980bd8dcba390146aad7817c47 (patch) | |
tree | 1465fe075644aa442604a5d6118227f1a353de16 /render | |
parent | 67425fcab50ef24a5617e109897f38876dd81277 (diff) |
render: Fix out of bounds access in SProcRenderCompositeGlyphs()
ZDI-CAN-14192, CVE-2021-4008
This vulnerability was discovered and the fix was suggested by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
(cherry picked from commit ebce7e2d80e7c80e1dda60f2f0bc886f1106ba60)
Diffstat (limited to 'render')
-rw-r--r-- | render/render.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/render/render.c b/render/render.c index c376090ca..456f156d4 100644 --- a/render/render.c +++ b/render/render.c @@ -2309,6 +2309,9 @@ SProcRenderCompositeGlyphs(ClientPtr client) i = elt->len; if (i == 0xff) { + if (buffer + 4 > end) { + return BadLength; + } swapl((int *) buffer); buffer += 4; } @@ -2319,12 +2322,18 @@ SProcRenderCompositeGlyphs(ClientPtr client) buffer += i; break; case 2: + if (buffer + i * 2 > end) { + return BadLength; + } while (i--) { swaps((short *) buffer); buffer += 2; } break; case 4: + if (buffer + i * 4 > end) { + return BadLength; + } while (i--) { swapl((int *) buffer); buffer += 4; |