|
|
8b16a4 |
From b62b942e805cdfdfd1e71ec752c08091d4c3229f Mon Sep 17 00:00:00 2001
|
|
|
8b16a4 |
From: akallabeth <akallabeth@posteo.net>
|
|
|
8b16a4 |
Date: Mon, 30 Mar 2020 18:05:17 +0200
|
|
|
8b16a4 |
Subject: [PATCH] Fix CVE-2020-11524: out of bounds access in interleaved
|
|
|
8b16a4 |
|
|
|
8b16a4 |
Thanks to Sunglin and HuanGMz from Knownsec 404
|
|
|
8b16a4 |
---
|
|
|
8b16a4 |
libfreerdp/codec/include/bitmap.c | 4 ++++
|
|
|
8b16a4 |
libfreerdp/codec/interleaved.c | 2 +-
|
|
|
8b16a4 |
2 files changed, 5 insertions(+), 1 deletion(-)
|
|
|
8b16a4 |
|
|
|
8b16a4 |
diff --git a/libfreerdp/codec/include/bitmap.c b/libfreerdp/codec/include/bitmap.c
|
|
|
8b16a4 |
index 602d1b333..734ed136d 100644
|
|
|
8b16a4 |
--- a/libfreerdp/codec/include/bitmap.c
|
|
|
8b16a4 |
+++ b/libfreerdp/codec/include/bitmap.c
|
|
|
8b16a4 |
@@ -338,6 +338,10 @@ static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer,
|
|
|
8b16a4 |
case MEGA_MEGA_COLOR_IMAGE:
|
|
|
8b16a4 |
runLength = ExtractRunLength(code, pbSrc, &advance);
|
|
|
8b16a4 |
pbSrc = pbSrc + advance;
|
|
|
8b16a4 |
+
|
|
|
8b16a4 |
+ if (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))
|
|
|
8b16a4 |
+ return FALSE;
|
|
|
8b16a4 |
+
|
|
|
8b16a4 |
UNROLL(runLength,
|
|
|
8b16a4 |
{
|
|
|
8b16a4 |
SRCREADPIXEL(temp, pbSrc);
|
|
|
8b16a4 |
diff --git a/libfreerdp/codec/interleaved.c b/libfreerdp/codec/interleaved.c
|
|
|
8b16a4 |
index a3fe7dd3f..0d36e9b9f 100644
|
|
|
8b16a4 |
--- a/libfreerdp/codec/interleaved.c
|
|
|
8b16a4 |
+++ b/libfreerdp/codec/interleaved.c
|
|
|
8b16a4 |
@@ -215,7 +215,7 @@ static INLINE BOOL ensure_capacity(const BYTE* start, const BYTE* end, size_t si
|
|
|
8b16a4 |
{
|
|
|
8b16a4 |
const size_t available = (uintptr_t)end - (uintptr_t)start;
|
|
|
8b16a4 |
const BOOL rc = available >= size * base;
|
|
|
8b16a4 |
- return rc;
|
|
|
8b16a4 |
+ return rc && (start <= end);
|
|
|
8b16a4 |
}
|
|
|
8b16a4 |
|
|
|
8b16a4 |
static INLINE void write_pixel_8(BYTE* _buf, BYTE _pix)
|
|
|
8b16a4 |
--
|
|
|
8b16a4 |
2.26.2
|
|
|
8b16a4 |
|