diff mbox series

[meta-oe,9/9] libgphoto2: patch CVE-2026-120452

Message ID 20261105200552.81303-9-ankur.tyagi85@gmail.com
State New
Headers show
Series [meta-oe,1/9] hdf5: patch CVE-2026-19026, CVE-2026-19027 and CVE-2026-19028 | expand

Commit Message

Ankur Tyagi Nov. 5, 2026, 8:05 p.m. UTC
From: Ankur Tyagi <ankur.tyagi85@gmail.com>

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

Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
---
 .../gphoto2/libgphoto2/CVE-2026-120452.patch  | 40 +++++++++++++++++++
 .../gphoto2/libgphoto2_2.5.34.bb              |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta-oe/recipes-graphics/gphoto2/libgphoto2/CVE-2026-120452.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-graphics/gphoto2/libgphoto2/CVE-2026-120452.patch b/meta-oe/recipes-graphics/gphoto2/libgphoto2/CVE-2026-120452.patch
new file mode 100644
index 0000000000..97e2318cbd
--- /dev/null
+++ b/meta-oe/recipes-graphics/gphoto2/libgphoto2/CVE-2026-120452.patch
@@ -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;
diff --git a/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.34.bb b/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.34.bb
index 488364b542..d8cf86ade2 100644
--- a/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.34.bb
+++ b/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.34.bb
@@ -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"