libgphoto2: patch CVE-2026-120452

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-120452

Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Ankur Tyagi authored and Khem Raj committed 2026-11-06 00:15:44 -08:00
1 parent 56beba6867
commit 26f80ca3e0
2 files changed
+41

No files matched your search

@@ -0,0 +1,40 @@
From 9fe9a565d4755d99255e34384bbb19f2a439b242 Mon Sep 17 00:00:00 2001
From: TheProtagonist07 <63047129+TheProtagonist07@users.noreply.github.com>
Date: Wed, 28 Oct 2026 19:19:32 +0530
Subject: [PATCH] jl2005c: bound thumbnail conversion by the real input length
jl2005bcd_decompress() picks thumbnail_width/height from a device header
byte and then byte-swaps that many RGB565 samples starting at input+16.
When the device claims a 128x120 thumbnail but the input buffer is smaller,
the loop reads and writes about 30 KB past the heap buffer.
Reject the conversion with GP_ERROR_CORRUPTED_DATA when the input is too
small. Addresses finding 3 of #1326.
(cherry picked from commit 30bf7ace6d47cfe1232ea73bde2aceb95aba4bfb)
CVE: CVE-2026-120452
Upstream-Status: Backport [https://github.com/gphoto/libgphoto2/commit/30bf7ace6d47cfe1232ea73bde2aceb95aba4bfb]
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
---
camlibs/jl2005c/jl2005bcd_decompress.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/camlibs/jl2005c/jl2005bcd_decompress.c b/camlibs/jl2005c/jl2005bcd_decompress.c
index 8c3307fd6..1c8a73c5b 100644
--- a/camlibs/jl2005c/jl2005bcd_decompress.c
+++ b/camlibs/jl2005c/jl2005bcd_decompress.c
@@ -123,6 +123,13 @@ jl2005bcd_decompress (unsigned char *output, unsigned char *input,
GP_DEBUG("No thumbnail is present!\n");
return GP_ERROR_NOT_SUPPORTED;
} else {
+ /* thumbnail_width/height come from a device header byte; the
+ * RGB565 payload that follows the 16-byte header must actually
+ * be large enough for that many samples. */
+ if (inputsize < 16 + 2 * thumbnail_width * thumbnail_height) {
+ GP_DEBUG("thumbnail larger than input\n");
+ return GP_ERROR_CORRUPTED_DATA;
+ }
out = malloc(thumbnail_width * thumbnail_height * 3);
thumb = (uint16_t *)(input + 16);
for (i = 0; i < thumbnail_width * thumbnail_height;
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/gphoto/${BP}.tar.xz;name=libgphoto2 \
file://40-libgphoto2.rules \
file://0001-configure-Filter-out-buildpaths-from-CC.patch \
file://CVE-2026-120451.patch \
file://CVE-2026-120452.patch \
"
SRC_URI[libgphoto2.sha256sum] = "51993f5d9bfb6b4e5925cbbe5883085791bff6f81bcacb8ffe1b783ce76d586a"