From: ankur.tyagi85@gmail.com
To: openembedded-devel@lists.openembedded.org
Cc: Ankur Tyagi <ankur.tyagi85@gmail.com>
Subject: [oe][meta-oe][PATCH 3/4] libvncserver: patch CVE-2026-32853
Date: Wed, 21 Oct 2026 00:03:56 +1300 [thread overview]
Message-ID: <20261020110357.1995120-3-ankur.tyagi85@gmail.com> (raw)
In-Reply-To: <20261020110357.1995120-1-ankur.tyagi85@gmail.com>
From: Ankur Tyagi <ankur.tyagi85@gmail.com>
Details:
https://nvd.nist.gov/vuln/detail/cve-2026-32853
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
---
.../libvncserver/CVE-2026-32853.patch | 76 +++++++++++++++++++
.../libvncserver/libvncserver_0.9.15.bb | 1 +
2 files changed, 77 insertions(+)
create mode 100644 meta-oe/recipes-graphics/libvncserver/libvncserver/CVE-2026-32853.patch
diff --git a/meta-oe/recipes-graphics/libvncserver/libvncserver/CVE-2026-32853.patch b/meta-oe/recipes-graphics/libvncserver/libvncserver/CVE-2026-32853.patch
new file mode 100644
index 0000000000..23d6a3df1f
--- /dev/null
+++ b/meta-oe/recipes-graphics/libvncserver/libvncserver/CVE-2026-32853.patch
@@ -0,0 +1,76 @@
+From 4d5c0ea960e4a22cd8b8fb3c6e18b5a1b1797783 Mon Sep 17 00:00:00 2001
+From: Kazuma Matsumoto <269371721+y637F9QQ2x@users.noreply.github.com>
+Date: Sun, 22 Mar 2026 20:35:49 +0100
+Subject: [PATCH] libvncclient: add bounds checks to UltraZip subrectangle
+ parsing
+
+HandleUltraZipBPP() iterates over sub-rectangles using numCacheRects
+(derived from the attacker-controlled rect.r.x) without validating
+that the pointer stays within the decompressed data buffer. A malicious
+server can set a large numCacheRects value, causing heap out-of-bounds
+reads via the memcpy calls in the parsing loop.
+
+Add bounds checks before reading the 12-byte subrect header and before
+advancing the pointer by the raw pixel data size. Use uint64_t for the
+raw data size calculation to prevent integer overflow on 32-bit platforms.
+
+(cherry picked from commit 009008e2f4d5a54dd71f422070df3af7b3dbc931)
+
+CVE: CVE-2026-32853
+Upstream-Status: Backport [https://github.com/LibVNC/libvncserver/commit/009008e2f4d5a54dd71f422070df3af7b3dbc931]
+Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
+---
+ src/libvncclient/ultra.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libvncclient/ultra.c b/src/libvncclient/ultra.c
+index 1d3aaba6..5633b8cb 100644
+--- a/src/libvncclient/ultra.c
++++ b/src/libvncclient/ultra.c
+@@ -126,6 +126,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
+ int toRead=0;
+ int inflateResult=0;
+ unsigned char *ptr=NULL;
++ unsigned char *ptr_end=NULL;
+ lzo_uint uncompressedBytes = ry + (rw * 65535);
+ unsigned int numCacheRects = rx;
+
+@@ -194,11 +195,18 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
+
+ /* Put the uncompressed contents of the update on the screen. */
+ ptr = (unsigned char *)client->raw_buffer;
++ ptr_end = ptr + uncompressedBytes;
+ for (i=0; i<numCacheRects; i++)
+ {
+ unsigned short sx, sy, sw, sh;
+ unsigned int se;
+
++ /* subrect header: sx(2) + sy(2) + sw(2) + sh(2) + se(4) = 12 bytes */
++ if (ptr + 12 > ptr_end) {
++ rfbClientLog("UltraZip: subrect %d header exceeds decompressed data bounds\n", i);
++ return FALSE;
++ }
++
+ memcpy((char *)&sx, ptr, 2); ptr += 2;
+ memcpy((char *)&sy, ptr, 2); ptr += 2;
+ memcpy((char *)&sw, ptr, 2); ptr += 2;
+@@ -213,8 +221,13 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
+
+ if (se == rfbEncodingRaw)
+ {
++ uint64_t rawBytes = (uint64_t)sw * sh * (BPP / 8);
++ if (rawBytes > (size_t)(ptr_end - ptr)) {
++ rfbClientLog("UltraZip: subrect %d raw data exceeds decompressed data bounds\n", i);
++ return FALSE;
++ }
+ client->GotBitmap(client, (unsigned char *)ptr, sx, sy, sw, sh);
+- ptr += ((sw * sh) * (BPP / 8));
++ ptr += (size_t)rawBytes;
+ }
+ }
+
+@@ -222,3 +235,4 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
+ }
+
+ #undef CARDBPP
++
diff --git a/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.15.bb b/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.15.bb
index 9fbec58c72..e2f995947f 100644
--- a/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.15.bb
+++ b/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.15.bb
@@ -48,6 +48,7 @@ SRC_URI = "git://github.com/LibVNC/libvncserver;branch=master;protocol=https;tag
file://0001-CMake-require-at-least-CMake-3.5.patch \
file://CVE-2026-44988.patch \
file://CVE-2026-32854.patch \
+ file://CVE-2026-32853.patch \
"
SRCREV = "9b54b1ec32731bd23158ca014dc18014db4194c3"
next prev parent reply other threads:[~2026-10-20 11:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 11:03 [oe][meta-oe][PATCH 1/4] libvncserver: patch CVE-2026-44988 ankur.tyagi85
2026-10-20 11:03 ` [oe][meta-oe][PATCH 2/4] libvncserver: patch CVE-2026-32854 ankur.tyagi85
2026-10-20 11:03 ` ankur.tyagi85 [this message]
2026-10-20 11:03 ` [oe][meta-oe][PATCH 4/4] libvncserver: patch CVE-2026-50538 ankur.tyagi85
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261020110357.1995120-3-ankur.tyagi85@gmail.com \
--to=ankur.tyagi85@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.